XML Command Line Switches...

lc6529lc6529 Posts: 30
I currently have a batchfile calling SQLDATACOMPARE to compare 1 table on two different servers, the target table is only supposed to have rows added or modified NOT deleted so I use the command line options

/Include:Missing /Include:Different /Include:Identical

The reason I use include:identical is I also have the output directed to a log file with a date stamp using command line options.

I am trying to convert this batchfile to use an XML argument file

I am having two problems.

#1: I cannot see how to do /Include:Missing /Include:Differrent
in the XML file

#2: I cannot get a date stamp in my output file, I tried using
/Arfile: [XML filename].XML >> [OutputFileName] but SQLDATACOMPARE did not like that.


Basically I need the XML Equivalent of

set LOG_TIMESTAMP=%date:~4,2%-%date:~7,2%-%date:~10,4%_%time:~0,2%%time:~3,2%

sqldatacompare /s1:Server1 /s2:Server2 /db1:DataBase1 /db2:Database2 /u1:userid1 /p1:password1 /u2:userid2 /p2:password2 /include:table:\[TableName\] /Include:Missing /Include:Different /Include:Identical /Out:c:\OutPutFileName_%LOG_TIMESTAMP%TXT

Does anyone have any suggestions?

Comments

  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Hi,
    To include missing/different/identical in the XML command file, you can use
    <Include>Missing</include>
    
    I take it the second request is to redirect output from SQLDATACOMPARE.exe to a file formatted by date. I believe you can create a batch file using the DATE command...
    REM assuming your dateformat is dd/mm/YYYY!
    @For /F "tokens=1,2,3 delims=/ " %%A in ('Date /t') do @(
    Set Day=%%A
    Set Month=%%B
    Set Year=%%C
    )
    sqldatacompare.exe /argfile:x.xml >> %Day%.%Month%.%Year%.txt
    
  • So I use

    <include>Table:\[TableName\]</include>

    AND

    <Include>Missing</include>
    <Include>Different</include>
  • Brian DonahueBrian Donahue Posts: 6,590 Bronze 1
    Yes.
Sign In or Register to comment.