T-SQL Object_Schema_Name metadata function returns the database schema name of objects.
Object_Schema_Name Syntax:
OBJECT_SCHEMA_NAME ( object_id [, database_id ] )
Object_Schema_Name Example:
SELECT OBJECT_SCHEMA_NAME(279672044) AS 'Schema object name of View',
OBJECT_SCHEMA_NAME(245575913,2) AS 'Schema object name of Table';
Schema object name of View | Schema object name of Table |
---|---|
dbo | dbo |
See also: T-SQL Functions -> OBJECT_NAME | SCHEMA_ID | SCHEMA_NAME