| description | SCHEMA_NAME (Transact-SQL) | ||
|---|---|---|---|
| title | SCHEMA_NAME (Transact-SQL) | Microsoft Docs | ||
| ms.custom | |||
| ms.date | 03/03/2017 | ||
| ms.prod | sql | ||
| ms.prod_service | database-engine, sql-database, sql-data-warehouse, pdw | ||
| ms.reviewer | |||
| ms.technology | t-sql | ||
| ms.topic | reference | ||
| f1_keywords |
|
||
| dev_langs |
|
||
| helpviewer_keywords |
|
||
| ms.assetid | 20071b77-2b6e-4ce7-a8e3-fa71480baf73 | ||
| author | julieMSFT | ||
| ms.author | jrasnick | ||
| monikerRange | >=aps-pdw-2016||=azuresqldb-current||=azure-sqldw-latest||>=sql-server-2016||>=sql-server-linux-2017||=azuresqldb-mi-current |
[!INCLUDE sql-asdb-asdbmi-asa-pdw]
Returns the schema name associated with a schema ID.
Transact-SQL Syntax Conventions
SCHEMA_NAME ( [ schema_id ] )
[!INCLUDEsql-server-tsql-previous-offline-documentation]
| 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)