kipregel
kipregel

Reputation: 153

How-to create SQL-script?

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

Answers (4)

Upendra Chaudhari
Upendra Chaudhari

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.

enter image description here

Upvotes: 1

Karan Shah
Karan Shah

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.

Generating script from existing stored procedures

Upvotes: 1

Raj More
Raj More

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

CharithJ
CharithJ

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.

enter image description here

Upvotes: 5

Related Questions