Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Stored Procedure

Author  Topic 

kid_on_the_block
Posting Yak Master

172 Posts

Posted - 2006-02-01 : 09:53:44
Hi

I have a database that had 50 stored procedures, I want to store all the code of the stored procedure in a text file.

Can that be done in one go, instead of me right click every sp & scripting it to a text file

Please help

sachinsamuel
Constraint Violating Yak Guru

383 Posts

Posted - 2006-02-01 : 10:06:50
1) Select the stored procedure for which you want to generate the script.

2) Right Click and say generate script

Regards
Sachin



Don't sit back because of failure. It will come back to check if you still available. -- Binu
Go to Top of Page

kid_on_the_block
Posting Yak Master

172 Posts

Posted - 2006-02-01 : 10:13:05
I want all the stored procedures in 1 go , here i will have to do this 50 times , I want all the sp to be scripted in just one task
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2006-02-01 : 10:21:00
In EM, highlight the names of all the SP's, RIGHT-CLICK, there's an option to script'em right there.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-02-01 : 10:24:41
or

EXEC Master..xp_cmdShell 'bcp "Select routine_definition from DBName.information_schema.routines where routine_type=''Procedure'' order by routine_name" queryout "C:\sp.sql" -c'

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -