Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top