locked
Usage of OPEN SYMMETRIC KEY and how to create master key RRS feed

  • Question

  • hi,

     

    I have done one database backup in SQL server 1and restored in SQL Server 2. When I run my application it executed one stored procedure and return following error message.

     

    "Please create a master key in the database or open the master key in the session before performing this operation.
    The key 'CodeKey01' is not open. Please open the key before using it."

     

    Below is my stored procedure structure.

     

    WITH EXECUTE AS OWNER

    AS

    SET NOCOUNT ON

    OPEN SYMMETRIC KEY CodeKey01 DECRYPTION BY CERTIFICATE AimsCert01;

    SET ANSI_NULLS OFF

    SELECT .......

    FROM

    Table

    WHERE

    Select @@ROWCOUNT

    SET ANSI_NULLS ON

    CLOSE SYMMETRIC KEY CodeKey01;

     

    Can any body help me..

    Friday, September 19, 2008 6:03 PM