Although a large amount of security metadata can be viewed from SQL Server Management Studio, there is some metadata that can only be viewed using T-SQL. Even for metadata that can be viewed through the GUI, such as the roles to which a database user belongs, there are times that it is best to use T-SQL—for example, if you need to script an action that you must perform on a regular basis or if you need to review metadata for many principals.
A complete guide to security metadata within SQL Server would be worthy of a book in its own right. Therefore, this chapter will explain some of the most useful ...