Microsoft SQL Server 2005 Books Online: "Security Functions (Transact-SQL)."
http://msdn2.microsoft.com/en-us/library/ms186236.aspx