Created
January 21, 2013 00:15
-
-
Save ronmichael/4582751 to your computer and use it in GitHub Desktop.
Add a certificate to a stored procedure in MSSQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- in this case we're giving the cert permission to alter the schema | |
-- (maybe explicitly disably identify and insert something into an identity column) | |
-- set up cert with permission to alter schema... | |
CREATE MASTER KEY ENCRYPTION BY password = '**opensesame**'; | |
CREATE CERTIFICATE SchemaCert WITH SUBJECT = 'Schema user Certificate' | |
CREATE USER SchemaCertUser FROM CERTIFICATE SchemaCert | |
GRANT ALTER ANY SCHEMA TO SchemaCertUser | |
-- run or rerun the following line whenever you alter procedure, | |
-- to give procedure permission to alter schema | |
ADD SIGNATURE TO [procedurename] BY CERTIFICATE SchemaCert | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment