OBJECT_SCHEMA_NAME

Returns the database schema name for schema-scoped objects.

Syntax

OBJECT_SCHEMA_NAME ( object_id [, database_id ] )

Arguments

object_id

Is the ID of the object to be used. object_id is int and is assumed to be a schema-scoped object in the specified database, or in the current database context.

database_id

Is the ID of the database where the object is to be looked up. database_id is int.

Return types

sysname

Example

SELECT DISTINCT OBJECT_SCHEMA_NAME(object_id)
  FROM master.sys.objects;

See Also