Managing role memberships
Published 20 August 2018
Post-Deployment script to add an environment specific role member
IF @@SERVERNAME = 'test-server' BEGIN DECLARE @return_status int EXEC @return_status = sp_addrolemember 'db_owner', 'a.tester' IF @return_status <> 0 SET NOEXEC ON END GO
- Post-Deployment scripts must be re-runnable as they will be executed as part of every deployment.
- Post-Deployment scripts are deployed to every environment.
@@SERVERNAMEis used to only grant a role membership to
- By default there is no error handling, so this script tests for an error, and sets
ONif an error occurs.