Command line options for script folders

Forum for users of SQL Compare schema synchronization utility

Command line options for script folders

Postby Ransha » Thu Dec 22, 2011 12:56 pm


I'm using the SqlCompare command line interface (version 8.5) trying to compare and sync 2 script folders. The batch I execute is as follows:

set scripts1=C:\\DB Upgrade\\NewDatabaseVersion
set scripts2=C:\\DB Upgrade\\OldDatabaseVersion
set output=C:\\DB Upgrade\\SchemaUpdate.sql

SQLCompare.exe /scr1:"%scripts1%" /scr2:"%scripts2%" /sf:"%output%" /f /sync /o:Default,ForceColumnOrder

I've also tried it without the "Default" option.

The resulting script does not contain any column order enforcing code. More specifically, I have a table that I've removed and added columns to and I would like to keep the order of the columns as they appear in the table's creation script.

Any ideas?
Ran Shani
Posts: 3
Joined: Thu Dec 22, 2011 12:39 pm
Location: Herzelya, Israel

Postby chriskelly » Fri Dec 23, 2011 2:32 pm

The "Force Column Order" option is used when "columns are inserted into the middle of a table" and it forces a rebuild of the table. This means that it copies the data into a temp table, drops the table and recreates it with the new column order and then inserts the data back in.

I am not sure what you mean by "column order enforcing code" as sql server itself does not do anything in this regard and so the t-sql is not always indicative of what is happening.

I would recommend that you test the script out on a test database first and observer the changes being made on that table. If you then do not see the changes that you expect, then please let me know.
Chris Kelly
Technical Support Engineer
Posts: 368
Joined: Mon Apr 19, 2010 12:44 pm
Location: Cambridge, UK

Postby Ransha » Mon Dec 26, 2011 8:20 am

I have tried the script before I posted a question here. The column's order is not saved in the table, i.e. the new columns are added at the end of the table.
To be more specific, the case is as follows: The table has one column which was renamed (which should be interpreted to a remove and add operations while its "index" should be preserved). There's also a new column which was added at the middle and a few that were added at the end. None of these columns appear in the order they should in the modified table (after executing the script on the database).
To conclude: the ForceColumnOrder has no affect on the comparison sync script.
Ran Shani
Posts: 3
Joined: Thu Dec 22, 2011 12:39 pm
Location: Herzelya, Israel

Return to SQL Compare Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests