2

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.

1
  • 1
    right click on your database name and then select task -> Generate Script -> and check stored procedures in it and the finish i hope this will do the work for you. Commented Sep 26, 2011 at 12:24

4 Answers 4

5

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

Sign up to request clarification or add additional context in comments.

1 Comment

just a minor correction: Right click on the database -> Tasks -> Generate Scripts -> ...
2

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

Comments

1

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

Comments

1

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

9 Comments

The OP did not ask how to script out a stored procedure. But how to script only the stored procedures in his database.
@hughjadick : jadick This will shows only SPs, not another tables or functions.
If you read the original question the author is asking for ALL stored procedures. Not ONE stored procedure.
@hughjadick : If you check my answer I written to select all stored procedures and then right click. In screenshot I have one SP so.
it is impossible to select more than one stored procedures in SQL Server Management Studio.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.