Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I perform a data compare on a VS 2013 SSDT project programmatically?

Visual Studio 2013 has a feature that allows for performing a data compare between your SSDT project and a target database.

According to another post here on SO, there are certain requirements with regards to performing such a compare.

Those requirements taken into consideration, I want to do something like this as a part of our build and deployment process:

  1. Publish any DB schema changes to the target database(s) to make sure that source and target have exactly the same tables, columns, SP's, etc. to comply with the requirements mentioned in the link above
  2. Run a data compare and generate an update script, or publish any changes in the source DB directly to the target DB

Currently, I have a script which takes care of bullet no. 1 by doing a schema compare, using a DACPAC, via sqlpackage.exe. It does not look like it is possible to perform a data compare using sqlpackage, though, and I have not found any other alternatives yet. In VS 2010 it was possible to run a data compare via the command window, but I have not seen any documentation regarding this in VS 2013...

Thus, my question is if there exists an API and/or other tools that allows for a data compare to be run programmatically through e.g. a Powershell script.

like image 357
nils1k Avatar asked Oct 20 '22 06:10

nils1k


1 Answers

It appears you are correct, for schema diff there is command line support as long as SSDT is installed on disk (more details here), but there is no programmatic interface yet for data compare and update.

like image 183
Cpt. Monac Avatar answered Oct 22 '22 22:10

Cpt. Monac