Options

Command line options for script folders

RanshaRansha Posts: 5
edited December 26, 2011 3:20AM in SQL Compare Previous Versions
Hi,

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

Comments

  • Options
    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.
  • Options
    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
Sign In or Register to comment.