How to include all tables in a script file?

j.salmonj.salmon Posts: 44 Bronze 2
According to the help, I should be able to use this command to copy data from all tables:
<Include objecttype="Table">

If I want to exclude any tables, I put the exclude list after the include:
<exclude objecttype="Table" matches="\[Table1\]" />


No data is being copied. Am I doing something wrong here?

Comments

  • j.salmonj.salmon Posts: 44 Bronze 2
    This is still an issue.............can I please get a response to this?
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hello,

    I'm sorry nobody has answered this. It does look like you're using the syntax for sqlcompare for sqldatacompare, though. I'm not sure if <include objecttype=x matches=y /> works for data compare. The last time I created an XML command file and ran it successfully, this is what I used:
    &lt;?xml version="1.0"?&gt; 
    &lt;commandline&gt; 
    &lt;server1&gt;localhost&lt;/server1&gt; 
    &lt;server2&gt;localhost&lt;/server2&gt; 
    &lt;database1&gt;WidgetDev&lt;/database1&gt; 
    &lt;database2&gt;WidgetLive&lt;/database2&gt; 
    &lt;include&gt;Table:Widgets&lt;/include&gt; 
    &lt;comparisonkeys&gt;Widgets:PK_Widgets&lt;/comparisonkeys&gt; 
    &lt;verbose/&gt; 
    &lt;/commandline&gt;
    
    Note that the format here is <include>objecttype:match</include>. It should be the same for exclude. I hope this helps!
  • j.salmonj.salmon Posts: 44 Bronze 2
    Hey Brian,

    Thanks for the response.

    Here's the /include help section from the SQL Data Compare command line help file version: 5.4.0.64 (accessed with the verbose and HTML options)

    /include:<object type>:<regular expression>


    Database objects or types to be included.

    Includes objects of the specified type whose identifiers match the specified regular expression. Note that /include and /exclude rules are applied in the order they are specified on the command line, or in the XML file containing the argument specification. If an object is matched by both an include and exclude rule then the exclude rule takes precedence. Note also that if an object has been explicitly included in the project file it will be included in the comparison even if no include rule matches it, unless it is excluded by an exclude rule. To include all objects of a type only specify the type (eg /include:View )
    Value Alias Description
    All - All database objects.
    Table - Tables.
    View - Views.

    The last line specifically states that to include all objects of a certain type, that the you should type </include:table>. What is the correct syntax.

    Again, for a small database, listing all tables with includes would probably be fine. For any normal to large sized database, this isn't really a practical thing to do. Also, this creates a large amount of maintenance to have numerous developers remember to add the tables to the file and retest nightly builds, etc. [/b][/i][/quote]
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Here is an XML command file that will compare all objects in the SQL Data Compare example databases WidgetDev and WidgetLive which are tables, except for WidgetReferences:
    &lt;?xml version="1.0"?&gt; 
    &lt;commandline&gt; 
    &lt;server1&gt;localhost&lt;/server1&gt; 
    &lt;server2&gt;localhost&lt;/server2&gt; 
    &lt;database1&gt;WidgetDev&lt;/database1&gt; 
    &lt;database2&gt;WidgetLive&lt;/database2&gt; 
    &lt;include&gt;Table&lt;/include&gt;
    &lt;exclude&gt;Table:\&#91;WidgetReferences\&#93;&lt;/exclude&gt; 
    &lt;verbose/&gt; 
    &lt;/commandline&gt;
    
    To do this from a command line rather than a saved XML argument file:
    SQLDataCompare /db1:WidgetDev /db2:WidgetLive /include:Table /exclude:Table:\&#91;WidgetReferences\&#93;
    
  • j.salmonj.salmon Posts: 44 Bronze 2
    Hey now! Thanks Brian, sorry I didn't figure that out on my own.

    Jon
Sign In or Register to comment.