T-SQL Tutorial

T-SQL Object_Definition


T-SQL Object_Definition Metadata function returns the source text of the definition of a specified object.

Object_Definition Syntax:

OBJECT_DEFINITION ( object_id )

Object_Definition Example:

SELECT OBJECT_DEFINITION(OBJECT_ID('master.dbo.products_list')) AS 'Object definition of my view';

Object definition of my view
CREATE VIEW products_list AS SELECT * FROM model.dbo.products ;

See also: T-SQL Functions -> APP_NAME | DB_ID | DB_NAME | OBJECT_ID