What are the challenges you face when working across database platforms? Take the survey

SQL compare command line to compare databases and generate script file

I used the SQL compare command line to compare two databases for testing purpose.
using an xml file like this
C:\Program Files (x86)\Red Gate\SQL Compare 12> sqlcompare /Argfile:c:/Projects/

I just compared one table which had a column datatype changed.
the generated script did not show alter table, instead saw a create table script with changed column appearing twice like this
>> [ServiceName] [varchar] (300) COLLATE Latin1_General_CI_AS NULL,
<< [ServiceName] [varchar] (250) COLLATE Latin1_General_CI_AS NOT NULL,

what option I should use to just generate a alter statement when using command line

If I use the SQL compare UI wizard, then I can see the alter statement in the generated comparison script.

My second question is when using xml file I cannot output the script to a file.
nor can I backup the database before deploying.

Will be grateful if you can help me




  • Options
    Hi - sorry for the confusion here

    The generated scripts you're seeing are the comparison between the two tables similar to the diff panel at the bottom of the comparison results UI. If you want a deployment script, you can use the /scriptfile:<filepath> option for the commandline - see this part of the documentation for more details

    You should be able to use the /makebackup option along with other /backup* options to add a backup command to the deployment script
Sign In or Register to comment.