Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
Azure Synapse Analytics
Analytics Platform System (PDW)
SQL analytics endpoint in Microsoft Fabric
Warehouse in Microsoft Fabric
Returns the schema ID associated with a schema name.
Database schemas act as namespaces or containers for objects, such as tables, views, procedures, and functions, that can be found in the sys.objects
catalog view.
Each schema has an owner. The owner is a security principal.
Transact-SQL syntax conventions
SCHEMA_ID ( [ schema_name ] )
The name of the schema. schema_name is sysname. If schema_name isn't specified, SCHEMA_ID
returns the ID of the default schema of the caller.
int
NULL
is returned if schema_name isn't a valid schema.
SCHEMA_ID
returns IDs of system schemas and user-defined schemas. SCHEMA_ID
can be called in a select list, in a WHERE
clause, and anywhere an expression is allowed.
SELECT SCHEMA_ID();
SELECT SCHEMA_ID('dbo');
Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register today