Home » sqlserverpedia-syndication »SSC »Tech and Learning »Tips » Currently Reading:

Quick note: Redgate SQL Data Compare using the command line

October 22, 2013 sqlserverpedia-syndication, SSC, Tech and Learning, Tips No Comments

compareI’ve been working on an automated data compare process for one client.  I’ve been struggling a little with odd hangups and errors with the SQL Data Compare command line interface, but one particular StackOverflow post solved my final problem. So here’s the final solution:

  1. Create a data compare project using the Redgate GUI.
  2. Run the compare – it must pick up at least one difference.
  3. When the results are shown, “check the tickbox between the 2 “Object Name” columns” (thanks again, StackOverflow guy!)
  4. Save your project.
  5. The command to run this compare will have the form
    /project:”<project filepath and name>”
    /scriptfile:<output file for sql script>
    /export:<export directory>

A note about the some elements:

  • <filepath> is the path to wherever sqlcompare.exe lives. On my computer, it’s “C:\Program Files (x86)\Red Gate\SQL Data Compare 10\sqldatacompare.exe”
  • <project filepath and name> is the location of your saved SDC file. For example, “c:\Data Compare\DB1 vs DB2.sdc”
  • <output file for sql script> is to create a new file with the SQL change migration scripts.
  • /include:identical “means the compare will not report an error if no changes are detected”.
  • /force will overwrite the sql script.
  • /export:<export directory> will exports the results as .csv files to the specified directory.

In my case, the full command looks like this:

“C:\Program Files (x86)\Red Gate\SQL Data Compare 10\sqldatacompare.exe” /project:”c:\Data Compare\DB1 vs DB2.sdc” /scriptfile:deploy_MyDBName.sql /include:identical /force /export:c:\temp\DB1vsDB2\

You can get additional options and explanations by running sqldatacompare.exe /?

Happy days,
Jen McCown
MidnightSQL Consulting

Comment on this Article:

Minion Reindex by MidnightDBA is here!


Excellent Index Maintenance

Download Minion Reindex, log feature requests, read documentation, and sign up for the newsletter at MidnightSQL.com/Minion!


MidnightSQL Consulting

Need help? Got an emergency? Write us at Support@MidnightDBA.com!

We can schedule time to help with your backup/restore issues, high availability and disaster recovery setup, performance problems, and a great deal more. Very often, we're even available on the moment for downtime issues and emergencies.

For more information about MidnightSQL consulting, email us or check out www.MidnightSQL.com. Happy days!

Where are We?

November 3-7: PASS Summit, Seattle, WA

PASS Summit: Jen is presenting How to Interview a DBA: A Panel Debate on Thursday 11/6 1:30pm, room 401 (along with Adam Machanic, Sean McCown, Bob Pusateri, and Michelle Ufford).

PASS Summit: Sean is presenting Performance Tuning Your Backups on Wednesday 11/5 3:00pm, room 602-604.

December 11: Presenting "Powershell Cmdlets.." at Alaska SQL Server User Group

January 30: "Become an Enterprise DBA" precon at Austin SQL Saturday

Blog Posts by Category


How to Eat Pop-tarts
Watch DBAs@Midnight live on Fridays,m 11pm Central time

The best database career advice you’ve never heard!


The DBA Roadmap Seminar is 7 MP3 tracks (over 5 hours!) of insider guidance on your database career. We'll teach you how and what to study as a DBA, weigh in on controversial resume debates, teach you to recognize a worthy recruiter, and discuss the new professionalism of interviews. Also some bonus materials, PDF companion guides, and really spiffy intro music!

Once your $99 PayPal payment is submitted, you'll get the download link in e-mail! (Download is a 370Mb ZIP file.)

Become a DBA. Become a BETTER DBA. Use the Roadmap.

Visit www.DBARoadmap.com for info, forums, and more!

Add to Cart View Cart

Cunningham’s Law

"The best way to get the right answer on the Internet is not to ask a question, it's to post the wrong answer."
Relevant: http://xkcd.com/386/