INFORMATION_SCHEMA.ROUTINES

To query INFORMATION_SCHEMA.ROUTINES views you can use the following Syntax:

Syntax:

SELECT Required Columns,
FROM INFORMATION_SCHEMA.ROUTINES;

Example: To get information about all the stored procedures in the database you can execute the following query:

Query:

SELECT SPECIFIC_NAME, ROUTINE_CATALOG, ROUTINE_SCHEMA, ROUTINE_NAME, ROUTINE_TYPE
FROM INFORMATION_SCHEMA.ROUTINES;

Output:

Output

Explanation: The above returns an output table having 5 columns. Where each column of the output table provides information about the stored procedures of the database.

How to use INFORMATION_SCHEMA Views in SQL Server

In SQL Server, INFORMATION_SCHEMA Views are a set of views provided by the INFORMATION_SCHEMA database in the SQL server that stores the metadata of the databases, tables, columns, and other objects stored in the system. In this article, we will learn how to use INFORMATION_SCHEMA Views in SQL Server.

Similar Reads

Using INFORMATION_SCHEMA Views in SQL Server

In SQL Server, INFORMATION_SCHEMA Views is a collection of views stored in the INFORMATION_SCHEMA database that allows users to retrieve metadata about various objects such as tables, constraints, procedures, and views from a database. The INFORMATION_SCHEMA database consists of several views, out of which not every view is crucial for the users....

Let’s set up an environment

To understand how we can use different categories of the INFORMATION_SCHEMA views in SQL Server, we will consider the following table Customers as shown below:...

1. Using INFORMATION_SCHEMA.TABLES

To query INFORMATION_SCHEMA.TABLES views you can use the following Syntax:...

2. Using INFORMATION_SCHEMA.COLUMNS

To query INFORMATION_SCHEMA.COLUMNS views you can use the following Syntax:...

3. INFORMATION_SCHEMA.VIEWS

To query INFORMATION_SCHEMA.VIEWS can use the following Syntax:...

4. INFORMATION_SCHEMA.ROUTINES

To query INFORMATION_SCHEMA.ROUTINES views you can use the following Syntax:...

5. INFORMATION_SCHEMA.CONSTRAINTS

To query INFORMATION_SCHEMA.CONSTRAINTS views you can use the following Syntax:...

Conclusion

In this article, we have learned about the INFORMATION_SCHEMA Views in SQL Server. We have learned that INFORMATION_SCHEMA views are a set of views stored in the INFORMATION_SCHEMA database that can be queried to extract crucial metadata about the databases, tables, and views in SQL Server. However, it is important to note that, the INFORMATION_SCHEMA views may not return all the information available in the system catalog views. Sometimes, you will have to query system catalog views directly to retrieve the required data....