using the command line to script a database

gsuttiegsuttie Posts: 80
edited September 9, 2009 10:03AM in SQL Data Compare Previous Versions
using the command line to script a database:-

sqldatacompare /db1:WidgetStaging /db2:WidgetProduction
/ScriptFile: "C:\Scripts Folder\WidgetSyncScript.sql"

how do i specify the server where the database is, i.e. somthing like this?

sqldatacompare /db1:SERVERNAME\WidgetStaging /db2:SERVERNAME\WidgetProduction
/ScriptFile: "C:\Scripts Folder\WidgetSyncScript.sql"

Comments

  • The switches you're looking for are /server1: and /server2: (or /s1: and /s2:). So your command line would look like the following:

    sqldatacompare /server1:SERVERNAME /db1:WidgetStaging /server2:SERVERNAME /db2:WidgetProduction /ScriptFile:"C:\Scripts Folder\WidgetSyncScript.sql"
    Software Developer
    Redgate Software
  • cheers for that... even simpler for setting up a static project, you can use an existing project definition (saves server,db and unames and pwds and everything else) ie...

    sqldatacompare /project:"C:\Documents and Settings\user\My Documents\SQL Data Compare\SharedProjects\LocalServercRemoteServer.sdc" /ScriptFile:"C:\Data\scripts\OutputSql.sql"
  • Im trying the following from a batch file:-

    cd "c:\program files\Red gate\SQL Data Compare 8"

    sqldatacompare.exe /server1:INVERNESS\SQL2005 /db1:GREGSTEST_DEV /scr2:"C:\Documents and Settings\gsuttie\Desktop\SQL continuos\ScriptsFolder\GREGSTESTSCRIPTS"

    /synchronize

    pause

    I have also tried /sync both erroring - where am i going wrong?

    Thanks
    Gregor
  • Hi

    Your syntax there looks fine to me - what is the error message you get when this fails?
    Roger Hart
    Technical author

    Red Gate Software Ltd
Sign In or Register to comment.