Retrieving SQL Server Metadata with Help of T-SQL

This article contains a list of scripts that mine the SQL Server metadata in the various system functions, stored procedures, tables, and catalog views. Metadata queries are really helpful in discovering information for a given database schema. You can copy all the T-SQL scripts that are listed in this article and use for your own purposes. However, please do some tests before apply to a production database.