Command Line data script generation

Compares and synchronizes SQL database content.

Moderators: Chris Auckland, David Atkinson, richardjm, david connell

Command Line data script generation

Postby DDaunais » Wed Jun 15, 2011 7:56 pm

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!
DDaunais
 
Posts: 1
Joined: Wed Apr 20, 2011 3:43 pm

Postby james.billings » Thu Jun 16, 2011 2:40 pm

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/C ... 419878.htm)
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.


Return to SQL Data Compare Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests