How-to create SQL-script?
I use MSSQL Management Studio 2005 Express Edition, and I h开发者_StackOverflow社区ave more than 100 stored procedures. How create sql-script which contain only stored procedures? Thanks.
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.
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
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.
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.
精彩评论