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?

up vote 1 down vote accepted

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 '16 at 15:31

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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