List out code of all stored procedure in SQL Server database

Posted by Raja under Sql Server category on | Views : 4292
You can execute following sql statement to get code of all user stored procedures.

SELECT mod.definition FROM sys.sql_modules mod INNER JOIN sys.objects obj ON mod.object_id = obj.object_id WHERE obj.type = 'p'

Comments or Responses

Posted by: Deeraj on: 1/6/2009 Level:Starter | Status: [Member]

In SQL Server 2005, much more simplified solution is available by the way of using Dynamic Management Views

Select top 1 routine_definition,* from information_schema.routines

Login to post response