Access to Stored Procedure

  • Anyone know if there is a way to access the actual text of a stored procedure from the system tables? As in when you click properties on a sproc in enterprise manager and view the actual text of the sproc.

    Another option would be to read it using .Net if anyone knows if that is possible.

    Thanks!

    JP

  • sp_helptext your_sp_name

  • You can use syscomments system table to retrieve the actual text of your SP.

    select text from syscomments where id = object_id(<your sp name>)

    Note:Your sp should not be encrypted. This system table does not show encrypted object.

    Blog: Gulappa

  • Right Click on the procedure name in Enterprise Manager and select "Generate SQL Script" form "All Tasks"

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply