3

I have multiple SQL Server databases that I would like to compare to one gold-standard database and produce a report/list with all of the differences between the two in terms of schema. This would be done automatically on a schedule.

I need to be able to do this problematically using C# to do this (meaning I can't use the GUI tool provided by SSDT). I also cannot use any third-party tools such as Red-Gate.

I'm having trouble finding any resources on how to go about doing this. Thanks.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • 2
    Writing your own for this is a ridiculously massive undertaking. It seems simple at the outset but once you dig in the layers start to unravel and you begin to understand why third party tool is better than writing your own. – Sean Lange Nov 20 '15 at 19:37

1 Answers1

3

If you put your database into a dacpac (SSDT project) then you can use sqlpackage.exe to compare the dacpac to each of the databases and use /Action:DriftReport for an xml list of changes or /Action:DeployReport. You can wrap the call to sqlpackage in a Process.Start (You might be able to also call the service directly but I can't see any docs to hand)

It sounds though that you are trying to build what redgate are building as the DLM dashboard - it is free to start with so take a look at that:

https://www.red-gate.com/products/dlm/dlm-dashboard/

Ed Elliott
  • 6,666
  • 17
  • 32