I am migrating a common set of databases in to a VS 2010 Sql Server Db project so we can keep it in source control, and deploy common changes etc.
The databases are for the most part the same, except for a couple schema changes based on the current environment.
The schema changes generally consist of altering how computed columns are calculated, or how stored procedures and functions calculate things (converting euro's to usd for monetary calculations when the envrionment is in the EU would be an example)

Currently the database has a set of stored procedures that make a few DDL changes based on data in the database. I need to add some DDL changes based on the environment, irrespective of data.

My question is, can I (or should I) manage the DDL differences in the db project post deploy script via if clauses and alter statements or should I migrate all of the changes to one time use stored procedures?

  • What do you mean by dynamic table? Do I understand it correctly that they are tables with different schema depending on the database they're belonging to? – Marian Mar 4 '13 at 19:48
  • Correct, dynamic schema based on the environment they are deployed in, but for the most part all the columns names stay the same, just how they are computed is dynamic. I will get it updated to be more clear. – Chris Mar 4 '13 at 20:00
  • If you can skip ahead to SSDT composite projects may work for you. Much the same approach as I described in Conditional compilation of SQL Server stored procedure. – Mark Storey-Smith Mar 4 '13 at 20:59
  • I am using SSDT as far as I know (I installed it and converted the project, I needed access to master as a reference). I'll give it a read today. Thanks. – Chris Mar 5 '13 at 14:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.