Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scripting out Stored Procs

Status
Not open for further replies.

jshurst

Programmer
Oct 27, 2004
1,158
0
0
US
I would like to be able to script out all stored procs in a given database. Basically I want to do this for backup purposes. I just execute a script and it writes out all my SP's to a file on the server.

I don't want to use Mangement Studio I want it automated from a SQL script. And I don't really want an entire DB backup.

Can someone tell me how to do this?

Thanks in advance,

J
 
I recently tried something similar with views mine was more for documentation purposes.


You can play with

-- View a list of stored procedures
SELECT *
from sys.objects
where type='p'

-- view the sp definition
-- change object_id with the actual number
SELECT OBJECT_DEFINITION (object_id)

Simi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top