Running bat file

dngdsdngds Posts: 2
edited February 28, 2014 6:48AM in SQL Compare Previous Versions
Hi

I have assumed management of 2 servers and SQL Compare is installed and used to sync instances that are replicated on both servers. Our nightly job runs a bat file that initiates the program. Other than that, I really don't know what it does and furthermore I don't know if there are reports produced in case if the nightly compare has discrepancies.

Can someone please decipher this for me and explain what SQL Compare is asked to do? Here is a sample of the code. Thank you

sqldatacompare /server1:... /database1:abc /username1:... /Password1:... /server2:... /database2:abc /username2:... /Password2:... /sync

Comments

  • Anu DAnu D Posts: 876 Silver 3
    Thanks for your post.

    First thing is your's is a SQL Data compare command line command and not SQL Compare.

    SQL Compare compares the schema of the two databases where as SQL Data Compare compares the data.

    More about them here: SQL Compareand SQL Data Compare

    Now looking at your SQL Data Compare command line: It is comparing 2 databases and synchronizing with the default option set.

    More information on command line for SQL Compare and SQL Data Compare.

    You also asked about any output file/email notification: You can use MAPI to send you email notification. The batch file will look something like this:
    C:
    
    cd c:\program files\Red Gate\SQL Compare 10
    
    SQLCompare /server1:(local) /server2:(local) /database1:WidgetDev /database2:WidgetProd /v /out:"C:\output.txt" /force
    
    IF %ERRORLEVEL% == 0 GOTO end
    
    :failed
    
    MAPISend -i -r support@somewhere.com -s "SQL Compare Error" -m "Failed job! Error Code:%Errorlevel%"
    
    :end
    
    Hope this answers all your questions.
    Anuradha Deshpande
    Product Support
    Redgate Software Ltd.
    E-mail: support@red-gate.com
Sign In or Register to comment.