SCHEMA_ID (Transact-SQL)
Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW) SQL analytics endpoint in Microsoft Fabric Warehouse in Microsoft Fabric
Returns the schema ID associated with a schema name.
Transact-SQL syntax conventions
Syntax
SCHEMA_ID ( [ schema_name ] )
Note
To view Transact-SQL syntax for SQL Server 2014 (12.x) and earlier versions, see Previous versions documentation.
Arguments
Term | Definition |
---|---|
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.
Remarks
SCHEMA_ID will return IDs of system schemas and user-defined schemas. SCHEMA_ID can be called in a select list, in a WHERE clause, and anywhere an expression is allowed.
Examples
A. Returning the default schema ID of a caller
SELECT SCHEMA_ID();
B. Returning the schema ID of a named schema
SELECT SCHEMA_ID('dbo');
See Also
Metadata Functions (Transact-SQL)
SCHEMA_NAME (Transact-SQL)
sys.schemas (Transact-SQL)
Visszajelzés
https://aka.ms/ContentUserFeedback.
Hamarosan elérhető: 2024-ben fokozatosan kivezetjük a GitHub-problémákat a tartalom visszajelzési mechanizmusaként, és lecseréljük egy új visszajelzési rendszerre. További információ:Visszajelzés küldése és megtekintése a következőhöz: