OBJECT_DEFINITION Metadata Function TSQL Tutorial

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