Home > Archive > MS SQL Server > November 2006 > Using system catalog views to retrieve OBJECT_DEFINITION for sproc









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Using system catalog views to retrieve OBJECT_DEFINITION for sproc
Tadwick

2006-11-29, 5:17 am

If I want to document my sprocs using system catalog views the
OBJECT_DEFINITION (object_id) retrieves raw text. Is there any way of
retrieving my code while retaining the formatting (ie indents).

Tx, Tad
thomarse

2006-11-30, 7:14 pm

If you're using SQL Server 2005 you can use sys.sql_modules

e.g.

select definition from sys.sql_modules
where object_id = object_id('your_proc
_name')

This retains the correct formatting.
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com