Due to deployment of a SSDT database project I would like to be able to switch the target database's recovery mode from FULL to BULK LOGGED and back after the deployment finished in order to do any data manipulation changes with minor invasive logging. I can't simply ignore the setting because deploying to development or staging environment should keep the SIMPLE setting but in production the setting should be switched back and forth.

Is it possible to "save" the original setting in Pre-Deployment script and restore this setting after the deployment? Do variables taken in pre-deployment keep alive between those scripts?

1 Answer 1


I doubt seriously that the entire deployment happens in one batch and therefore variables wouldn't persist throughout the deploy (but you could test it). What I think makes more sense is to just store any "pre" values in a temp table (maybe a global temp table) and then retrieve them during the post deploy.

  • You are right any variables are not persisted between the scripts, they just die. I like your idea to store some information in tables inbetween.
    – Magier
    Feb 2, 2016 at 15:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.