Click here to Skip to main content
15,912,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello people....!!!

So, I´d like to know if there is some way to create a procedure and it get the creation code of all procedures at my base....

example: I´ve the procedures x,y,z, already created at my base......so, there is some way to get the creation code of them x,y,z....

that´s the code what I want ----> (create procedure x(@param)....)

There´s some way to do that ????

So, I only got the procedure names through sys.procedures....

Sorry if this question already exists here.....however I did search and didn´t found anything like.....

Since then, thank you.....and sorry about my english.....

[]´s
Posted
Comments
Herman<T>.Instance 17-Sep-11 14:20pm    
well....what is your exact problem?
Do you use Sql Server management studio?
gollum85 20-Sep-11 10:19am    
so man, I know that it can be easy through the Sql Server management studio
but I need to do it through the application understand ???
anyway thanks

 
Share this answer
 
Comments
gollum85 20-Sep-11 10:29am    
so man, thank u, in one of this link that u gave me, I found something that worked for me....
and if interests to somebody, so I used the follow expression

EXEC sp_helptext ‘objectName’....

thank u man....!!
[no name] 20-Sep-11 11:24am    
welcome
Check this if it works for you.
SQL
select ROUTINE_NAME , ROUTINE_TYPE, ROUTINE_DEFINITION  from INFORMATION_SCHEMA.ROUTINES 
 
Share this answer
 
Comments
gollum85 20-Sep-11 10:26am    
so, I don´t understand how to use it.....but thanks man
If you use SQL Server Management studio, it's pretty easy:
1) Right click the database you are interested in.
2) Select "Tasks...Generate Scripts" from the context menu.
3) In the resulting dialog, press "Next" until you get to the "Choose Objects" screen.
4) Click the "Select Specific database objects" Radio button.
5) Put a tick in the "Stored Procedures" check box.
6) Press "Next" and set your destination.
7) Press "Next" twice, and the file will be created.
8) Press "Finish" to close.
 
Share this answer
 
Comments
gollum85 18-Sep-11 11:03am    
thank you for try to help me OriginalGriff, so I have already know, but it does not work for me, because I have to do that through the application.....anyway thanks....!!!
Agecanonix 18-Sep-11 12:23pm    
@gollum85: Then have a look at SQL Server Management Objects (SMO): http://msdn.microsoft.com/en-us/library/ms162169.aspx There are several ways to script database objects. See this for instance: http://msdn.microsoft.com/en-us/library/ms211012.aspx
gollum85 20-Sep-11 10:20am    
so man, i looked there but got nothing.....anyway thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900