1

We have 3 different SchemaCompare files we run manually (saved from the built-in feature in TFS). These saved files contain the Source and Destination databases to compare against. One is to compare our DEV environment to TFS and another for what's in UAT environment to TFS.

We make use of SQLCMD variables for the database names { [$(DatabaseStage) }. These SQLCMD variable are different for each environment. Currently, we have to go into the properties of each database project to change the variables to match up with the the environment we're comparing against.

It would be great if the SQLCmd variables could be saved in the actual saved schema compare file. Is this possible or any workarounds?

saved schema script files

Gabe
  • 5,113
  • 11
  • 55
  • 88
  • I'll agree with that, but have you tried just saving the comparisons for each environment? They won't show up in the project without doing a "show all files" and including them, but that should work. We've saved a couple and just use those quickly to do comparisons against our different environments as needed. – Peter Schott Jul 08 '14 at 22:53
  • @PeterSchott I'm sorry, could you explain what you mean by "saving the comparisons for each environment"? I think that's what I'm doing. I do a schema compare and then save those files. I've attached two images to the original question to clarify what I'm doing. – Gabe Jul 09 '14 at 15:58
  • When you do your schema compare, you can choose to save that into your project folders. (I created a new folder called "Schema Compares" for that purpose.) You'll have to "show all files" for the project to see them, but you can then include them in the project and reference them easily. From what I can see, you're doing that already. At that point, the DBname/Connection should just be part of that schema compare so you shouldn't have to change anything. If you want something more powerful, you may want to look at Red-Gate's Schema Compare, though it won't integrate w/ SSDT at this time. – Peter Schott Jul 09 '14 at 19:14
  • @PeterSchott The issue is that it doesn't save the SQLCMD variables and we have about 5 of them to replace for each schema compare. No biggie, just a minor inconvenience. – Gabe Jul 10 '14 at 16:55
  • True - I haven't had to use them too much within my current work. You might be able to use SQLpackage to generate the XML Diff Report and a SQL Script. The Diff report is useful to know what's going to change, even if not the specifics. Those can take SQLCMD variables. I guess I misunderstood and thought that the variables were used purely to drive the DB names and those can be stored within the compare files. – Peter Schott Jul 10 '14 at 17:10

0 Answers0