Key_ID (Transact-SQL)
SQL Server 2005
Returns the ID of a symmetric key in the current database.
Transact-SQL Syntax Conventions
A. Returning the ID of a symmetric key
The following example returns the ID of a key called ABerglundKey1.
SELECT KEY_ID('ABerglundKey1')
B. Returning the ID of a temporary symmetric key
The following example returns the ID of a temporary symmetric key. Note that # is prepended to the key name.
SELECT KEY_ID('#ABerglundKey2')
