SCHEMA_ID() Metadata Function TSQL Tutorial

Returns the schema id (int type) associated with a schema name.

SCHEMA_ID() Syntax:

SCHEMA_ID()
SCHEMA_ID ( [ schema_name ] )

SCHEMA_ID() Example:

SELECT SCHEMA_ID() AS 'Schema id',
SCHEMA_ID('dbo') AS 'Schema id by name';

Schema idSchema id by name
11

See also: T-SQL Functions -> OBJECT_NAME | OBJECT_SCHEMA_NAME | SCHEMA_NAME