Ask a questionAsk a question
 

AnswerA question about "setvar" and deployment

  • Tuesday, June 30, 2009 6:10 PMDaniel Pratt Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    It seems that if I want to be able to deploy changes to a database from a project (via the "Deploy" action), I have to live with the fact that there will be hard-coded ":setvar" statements in the generated script to set the target database. Is this correct?

    I ask because the script takes quite a while to generate and I have a high degree of confidence that the generated script will be appropriate for other databases as well. Thus I want to re-use the script, supplying a different database as a parameter to SQLCMD.

    I see that there is an option to "comment out" the ":setvar" statements, which would allow me to specify a value for those parameters via SQLCMD. Unfortunately, this also prevents the "Deploy" target of the project from being able to automatically update the target database.

    If there is a way that I can have my cake and eat it too, please let me know :)

    Thanks,
    Daniel

Answers

  • Tuesday, June 30, 2009 7:20 PMBarclay HillMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Daniel,

    You can have your cake and eat it too.  Database.sqldeployment options can be customized per configuration.  This will allow you to deploy with setvars for DEBUG and deploy to script without setvars for Release or however you want to define your configurations.

    Thanks,
    Barclay Hill Program Manager VSTS: DB Team (DataDude, DBPro, Database Edition) Please mark the responses as answer if it resolves your question.

All Replies

  • Tuesday, June 30, 2009 7:20 PMBarclay HillMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    Daniel,

    You can have your cake and eat it too.  Database.sqldeployment options can be customized per configuration.  This will allow you to deploy with setvars for DEBUG and deploy to script without setvars for Release or however you want to define your configurations.

    Thanks,
    Barclay Hill Program Manager VSTS: DB Team (DataDude, DBPro, Database Edition) Please mark the responses as answer if it resolves your question.