Database Knowledge Base / MS SQL Server /
Add comment
Name:
Email:
* Comment:
(Use BBcode - No HTML)
code
* Confirmation code:   Write the characters in the image above exactly as you see it


Is there an easy way to loop through every stored procedure in a database and create a file containing all of the SP code?

By joining sysobject and syscomments table we can get your desired results,
run this query in Query Analyzer (with result in text mode)....
-----------------------------------------------------------------------------
SELECT dbo.syscomments.text, dbo.sysobjects.name
FROM dbo.syscomments INNER JOIN
dbo.sysobjects ON dbo.syscomments.id = dbo.sysobjects.id
WHERE (dbo.sysobjects.xtype = 'p')
-----------------------------------------------------------------------------



RSS