How to get SQL Server schema id

To get SQL Server schema id uses function SCHEMA_ID().

Syntax

SCHEMA_ID ( )

SCHEMA_ID ( 'schema name' )


Example

SELECT SCHEMA_ID();

SELECT SCHEMA_ID('dbo');

See also: SCHEMA_ID