SCHEMA_ID

Returns the schema ID associated with a schema name.

Syntax

SCHEMA_ID ( [ 'schema_name' ] )

Arguments

schema_name

Is the name of the schema. schema_name is a sysname. If schema_name is not specified, SCHEMA_ID will return the ID of the default schema of the caller.

Return types

int

NULL will be returned if schema_name is not a valid schema.

Example

SELECT SCHEMA_ID();

See Also