• the Database Master key always has an symmetric_key_id = 101, i read someplace, so my scripts all use that:

    IF NOT EXISTS (SELECT * FROM sys.symmetric_keys WHERE symmetric_key_id = 101)

    BEGIN

    PRINT 'Creating Database Master Key'

    CREATE MASTER KEY ENCRYPTION BY PASSWORD = 'NotTheRealPassword'

    END

    ELSE

    BEGIN

    PRINT 'Database Master Key Alread Exists'

    END

    --drop certificate MyDemoDataSecurityCertificate?

    --create our certificate.

    IF NOT EXISTS(SELECT *

    FROM sys.certificates

    WHERE name = 'MyDemoDataSecurityCertificate')

    BEGIN

    CREATE CERTIFICATE MyDemoDataSecurityCertificate WITH SUBJECT = 'MyDemo DataSecurity Certificate', EXPIRY_DATE = '12/31/2024'

    PRINT 'MyDemoDataSecurityCertificate Created'

    END

    ELSE

    BEGIN

    PRINT 'MyDemoDataSecurityCertificate Already Exists.'

    END

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!