T-SQL 101: 127 Querying the SQL Server System Catalog
There are times that you need to be able to query the database and its internal structures rather than querying the user tables.
In the example above, I’ve asked for details of all the databases, and then for details of all the schemas in the current database, followed by details for all the tables and columns in the current database.
These are a well-designed set of system views that are easy to work with. They are often referred to as catalog views. You can even see all of them as part of querying sys.views.
2025-03-10