SQL Compare: How to filter out changes to views/functions/procs based on content
gbritton
Posts: 17 Bronze 1
in SQL Compare
One environment I support has separate databases for staging and etl'd data. e.g. data is loaded into MyStaging from various sources, cleaned up then finally loaded in to MyGoodData for downstream use. That means that for some operations, we cannot avoid 3-part naming. e.g. when querying metadata (like sys.tables) in MyStaging from a proc in MyGoodData.
now, this all works fine, but in lower environments, devs have their own copies of these dbs, often appending their initials to differentiate. That's also OK *except* when comparing databases. How can I tell SQL Compare to compare MyGoodData_ab with MyGoodData_cd but ignore differences where the only difference is in the staging database names?
e.g. in MyGoodData_ab I might have a proc with a line like:
if exists (select * from MyStaging_ab.sys.tables where name = 'foobar')
and the proc is identical in MyGoodData_cd except for the same line where it reads;
if exists (select * from MyStaging_cd.sys.tables where name = 'foobar')
The only difference is the reference to a different database in the 3-part name. That's what I don't care about.
As it is, after SQL Compare runs, I have to manually filter the results to exclude examples like this. Any clever way to bend SQL Compare to my will and get it to exclude these "false positives"?
now, this all works fine, but in lower environments, devs have their own copies of these dbs, often appending their initials to differentiate. That's also OK *except* when comparing databases. How can I tell SQL Compare to compare MyGoodData_ab with MyGoodData_cd but ignore differences where the only difference is in the staging database names?
e.g. in MyGoodData_ab I might have a proc with a line like:
if exists (select * from MyStaging_ab.sys.tables where name = 'foobar')
and the proc is identical in MyGoodData_cd except for the same line where it reads;
if exists (select * from MyStaging_cd.sys.tables where name = 'foobar')
The only difference is the reference to a different database in the 3-part name. That's what I don't care about.
As it is, after SQL Compare runs, I have to manually filter the results to exclude examples like this. Any clever way to bend SQL Compare to my will and get it to exclude these "false positives"?
Answers
Thanks for your suggestion.
Can you please kindly cast your vote on this user voice post?
Tianjiao Li | Redgate Software
Have you visited our Help Center?
Just to let you know we are looking at allocating more votes to you or other options.
Tianjiao Li | Redgate Software
Have you visited our Help Center?
You should be able to vote now. Please give it a try and let us know if there is any issue.
Tianjiao Li | Redgate Software
Have you visited our Help Center?
NB: do need to keep track of what synonyms you have set up and only deviate where they point on non-production databases