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 name associated with a schema ID.
Transact-SQL syntax conventions
SCHEMA_NAME ( [ schema_id ] )
Term | Definition |
---|---|
schema_id | The ID of the schema. schema_id is an int. If schema_id is not defined, SCHEMA_NAME will return the name of the default schema of the caller. |
sysname
Returns NULL when schema_id is not a valid ID.
SCHEMA_NAME returns names of system schemas and user-defined schemas. SCHEMA_NAME can be called in a select list, in a WHERE clause, and anywhere an expression is allowed.
SELECT SCHEMA_NAME();
SELECT SCHEMA_NAME(1);
Expressions (Transact-SQL)
SCHEMA_ID (Transact-SQL)
sys.schemas (Transact-SQL)
sys.database_principals (Transact-SQL)
Metadata Functions (Transact-SQL)
WHERE (Transact-SQL)
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