Three of the system catalog views in SQL Server include sys.views, sys.system_views, and sys.all_views.
These three catalog views all provide metadata about views in the database, but there’s a subtle difference between each view.
Database Management Systems
Three of the system catalog views in SQL Server include sys.views, sys.system_views, and sys.all_views.
These three catalog views all provide metadata about views in the database, but there’s a subtle difference between each view.
If you’ve ever queried the sys.identity_columns view in SQL Server, you’ll know that it returns a list of identity columns. It also returns the object_id of the table, but not the table name or its schema.
You can use the code examples in this article to return the identity columns, along with their respective tables and schemas.
You can use T-SQL to return a list of identity columns in a database in SQL Server.
You can do this using the sys.identity_columns system catalog view.
You can use T-SQL to return a list of trigger events in a database in SQL Server.
You can do this using sys.trigger_events. This system catalog view returns a row for each event or event group on which a trigger can fire.
Here’s a hierarchical list of trigger event types that are returned in my SQL Server 2019 for Linux environment.
This list was created using this query.
Here’s a hierarchical list of trigger event types that are returned in my SQL Server 2017 for Linux environment.
This list was created using this query.
In SQL Server, you can use the following T-SQL queries to return a hierarchical list of trigger event types.
These examples query the sys.trigger_event_types view, which returns a row for each event or event group on which a trigger can fire.
In SQL Server, you can use sys.trigger_event_types to return all events or event groups on which a trigger can fire.
In SQL Server, you can use the CRYPT_GEN_RANDOM() function to return a cryptographic, randomly-generated number. The number is generated by the Cryptographic Application Programming Interface (CAPI).
CAPI is a Microsoft Windows platform specific application programming interface included with Microsoft Windows operating systems that provides services to enable developers to secure Windows-based applications using cryptography.
The CRYPT_GEN_RANDOM() function accepts two arguments: the length (required), and a seed (optional).
The return value is varbinary(8000).
This article presents four ways to return a list of user-defined views in a SQL Server database.
If you want to see only system views, or both user-defined and system views, see Difference Between sys.views, sys.system_views, & sys.all_views in SQL Server.