Applies to: SQL Server (all supported versions) Azure SQL Database Azure SQL Managed Instance
Returns the GUID of a symmetric key in the database.
Key_GUID( 'Key_Name' )
To view Transact-SQL syntax for SQL Server 2014 and earlier, see Previous versions documentation.
' Key_Name '
The name of a symmetric key in the database.
If an identity value was specified when the key was created, its GUID is an MD5 hash of that identity value. If no identity value was specified, the server generated the GUID.
If the key is a temporary key, the key name must start with a number sign (#).
Because temporary keys are only available in the session in which they are created, no permissions are required to access them. To access a key that is not temporary, the caller requires some permission on the key and must not have been denied VIEW permission on the key.
The following example returns the GUID of a symmetric key called