The T-SQL Schema_Name() Metadata Function returns the schema name associated with a schema id.
Schema_Name() Syntax:
SCHEMA_NAME()
SCHEMA_NAME ( [ schema_id ] )
Schema_Name() Example:
SELECT SCHEMA_NAME() AS 'Schema name',
SCHEMA_NAME(1) AS 'Schema name by id';
Schema name | Schema name by id |
---|---|
dbo | dbo |
See also: T-SQL Functions -> OBJECT_NAME | OBJECT_SCHEMA_NAME | SCHEMA_ID