Reputation: 153
I use MSSQL Management Studio 2005 Express Edition, and I have more than 100 stored procedures. How create sql-script which contain only stored procedures? Thanks.
Upvotes: 2
Views: 1134
Reputation: 6543
Open Databases >> DBName >> Programability >> Stored Procedures in Object Explorer Details and then select all procedures except "System Stored Procedures" folder and right click on it and select "Script Stored Procedures as >> Create To >>" option.
Upvotes: 1
Reputation: 752
Right click on ur database name -> Select Task -> Generate Script -> Next -> Next -> Select things to be scripted ->next - > Select All -> Finish
i have posted an image for help.
Upvotes: 1
Reputation: 48068
If you do exec SP_HelpText StoredProcedureNameGoesHere
, you will get the full script of that procedure.
Do this to get 5 procedures (you get the picture)
exec SP_HelpText StoredProcedure01
exec SP_HelpText StoredProcedure02
exec SP_HelpText StoredProcedure03
exec SP_HelpText StoredProcedure04
exec SP_HelpText StoredProcedure05
Here's a script to generate the script for all procedures in your db.
SELECT 'Exec sp_Helptext ' + SPECIFIC_NAME
FROM INFORMATION_SCHEMA.Routines
Upvotes: 2
Reputation: 47610
Right click on the database -> Tasks -> Generate Scripts -> Go through the steps -> There are check boxes to select Tables, SPs, UDFs and Users. Select only SPs and create the script.
Here is the starting point.
Upvotes: 5