Click to Rate and Give Feedback
MSDN
MSDN Library
SQL Server
SQL Server 2008
Database Engine
Technical Reference
 CLOSE SYMMETRIC KEY (Transact-SQL)
Community Content
In this section
Statistics Annotations (0)
Collapse All/Expand All Collapse All
Other versions are also available for the following:
SQL Server 2008 Books Online (October 2009)
CLOSE SYMMETRIC KEY (Transact-SQL)

Closes a symmetric key, or closes all symmetric keys open in the current session.

Topic link icon Transact-SQL Syntax Conventions

CLOSE { SYMMETRIC KEY key_name | ALL SYMMETRIC KEYS }
Key_name

Is the name of the symmetric key to be closed.

Open symmetric keys are bound to the session not to the security context. An open key will continue to be available until it is either explicitly closed or the session is terminated. CLOSE ALL SYMMETRIC KEYS will close any database master key that was opened in the current session by using the OPEN MASTER KEY statement. Information about open keys is visible in the sys.openkeys (Transact-SQL) catalog view.

No explicit permission is required to close a symmetric key.

A. Closing a symmetric key

The following example closes the symmetric key ShippingSymKey04.

CLOSE SYMMETRIC KEY ShippingSymKey04;
GO

B. Closing all symmetric keys

The following example closes all symmetric keys that are open in the current session, and also the explicitly opened database master key.

CLOSE ALL SYMMETRIC KEYS;
GO
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement | Site Feedback
Page view tracker