Red Gate forums :: View topic - Command Line data script generation
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Data Compare Previous Versions
SQL Data Compare Previous Versions forum

Command Line data script generation

Search in SQL Data Compare Previous Versions forum
Post new topic   Reply to topic
Jump to:  
Author Message
DDaunais



Joined: 20 Apr 2011
Posts: 1

PostPosted: Wed Jun 15, 2011 7:56 pm    Post subject: Command Line data script generation Reply with quote

Hello, I am trying to generate a data synchronization script between a database and a scripts folder (the scripts are generated by SQL Source Control). We use SQL Source Control, SQL Compare, and SQL Data Compare as tools. We source control database objects and some static data using SQL Source Control into TFS. We use SQL Compare and SQL Data Compare to generate deployment scripts in a continuous integration manner. This part seems to be working fine.

We also want to use these tools to generate reasonable rollback scripts. For database objects this is easy enough. For data rollback scripts, it is a little bit more challenging.

The database may have tables a, b, and c. The scripts folder may only contain data for table b. (but has the definitions for all tables).

When running SQLDataCompare from the command line, is there a way to generate data scripts for only tables that match between the two? When I try this now, an entire series of INSERT statements is generated for tables a and c, while the appropriate delta is generated for table b.

The sample syntax that I'm using looks something like this:
sqldatacompare.exe /server1:server1 /database1:"db1" /scr2:"c:\folder" /scriptfile:"c:\foo.sql" /include:identical

Thanks in advance for any pointers!
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1121
Location: My desk.

PostPosted: Thu Jun 16, 2011 2:40 pm    Post subject: Reply with quote

We made a change recently so that if you are comparing scripts as the source to a DB as the target, it will only work with tables that have a file in the Data folder.
Unfortunately, this doesn't apply the other way around; so if you have the DB as the source and the scripts as the target, it'll still check all tables (because you may well want to add data from tables that don't currently have any in the scripts)

You can include / exclude records based on whether they are only on one side of the comparison or not, by using the additional / missing options along with /include or /exclude - does that help at all?

(You can see about those options in the commandline switches: http://www.red-gate.com/supportcenter/Content?p=SQL%20Data%20Compare&c=SQL_Data_Compare/help/9.0/SDC_CL_Switches.htm&toc=SQL_Data_Compare/help/9.0/toc1419878.htm)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group