How execute SELECT query in Sql server Post-Deployment Script

  • binutb

    SSCommitted

    Points: 1741

    Hi,

    How execute SELECT query in Sql server dacpack Post-Deployment Script.

    Is it possible conditional statement (IF statement) in Post-Deployment Script ?

    Thanks in advance

    Regards

    Binu

  • binutb

    SSCommitted

    Points: 1741

    hi,

     

    anybody can help...

     

    Regards

    binu

  • binutb

    SSCommitted

    Points: 1741

    hi,

     

    anybody can help

     

    Regards

    binu

  • Schadenfreude-Mei

    SSChampion

    Points: 14083

    Can you explain what it is you are trying to do?

    Adam Zacks-------------------------------------------Be Nice, Or Leave

  • Lowell

    SSC Guru

    Points: 323356

    i think you need to execute a script after the dacpac deployment.

    a dacpac will create tables and objects, but there's no scripting involved, so no, no script can be appended to the dacpac.

    a script can contain all the logic you desire, and that's where you might have conditional scripts based on s ervername, environment, time or anything else you want to test for, and use logic to execute.

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • Phil Parkin

    SSC Guru

    Points: 243531

    I cannot see how executing a SELECT query in a post-deployment script will achieve anything useful. Where are you expecting the SELECTed data to go?

    If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

  • Phil Parkin

    SSC Guru

    Points: 243531

    Lowell wrote:

    i think you need to execute a script after the dacpac deployment. a dacpac will create tables and objects, but there's no scripting involved, so no, no script can be appended to the dacpac. a script can contain all the logic you desire, and that's where you might have conditional scripts based on s ervername, environment, time or anything else you want to test for, and use logic to execute.

    This is not necessarily correct. If you develop your database in SSDT, adding a post-deployment script is a straightforward task. When this database is Published, a DACPAC is created which contains the post-deployment script. The PD script is executed as part of the Publish action.

    • This reply was modified 2 months, 2 weeks ago by  Phil Parkin.

    If the answer to your question can be found with a brief Google search, please perform the search yourself, rather than expecting one of the SSC members to do it for you.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply