Reputation: 133
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.
Upvotes: 3
Views: 1257
Reputation: 6856
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/
Upvotes: 3