SQLUSA

Microsoft SQL Server 2008
Database Design Best Practices

How to use the object_definition system function?

 

Execute the following script in Query Editor to demonstratate the use of object_id, object_schema_name, object_name and object_definition system functions:

/*

OBJECT_DEFINITION applies to the following object types:

 

C = Check constraint

D = Default

P = SQL stored procedure

FN = SQL scalar function

R = Rule

RF = Replication filter procedure

TR = SQL trigger

IF = SQL inline table-valued function

TF = SQL table-valued function

V = View

 

*/

USE AdventureWorks2008;

 

SELECT object_id ('HumanResources.uspUpdateEmployeeHireInfo')

GO

-- 87671360

 

SELECT object_schema_name(87671360),object_name(87671360)

GO

 

-- Returns object create statement

SELECT object_definition(87671360)

GO

 

The Best SQL Server 2008 Training in the World
 
 
SQLUSA.com Home Page