Click here to Skip to main content
14,920,935 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi,

How to Create a script of Stored Procedures from C# ?

My requirement is to take backup of stored procedures & functions from sql server database using c# ?

Thanks in Advance.
Posted
Comments
Varun Sareen 15-Feb-12 2:30am
   
Only stored procedures and functions not whole db?
[no name] 19-Feb-12 2:31am
   
yes.....

try to look for this tool.
ScriptDB
[^]

It uses SQL Management Objects (SMO) to script the database objects.
   
Comments
thatraja 15-Feb-12 3:09am
   
5!
Manfred Rudolf Bihy 15-Feb-12 6:10am
   
Have a 5!
Michael dg 15-Feb-12 8:24am
   
thank you
Mukund Thakker 16-Feb-12 1:33am
   
Doesn't work, gives following error
Exception caught in Main()
---------------------------------------
Could not load file or assembly 'Microsoft.SqlServer.ConnectionInfo, Version=9.0
.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependen
cies. The system cannot find the file specified.

System.IO.FileNotFoundException

at Elsasoft.ScriptDb.DatabaseScripter.GenerateScript(String connStr, String o
utputDirectory, Boolean scriptData, Boolean verbose, Boolean scriptProperties)
at Elsasoft.ScriptDb.Program.Main(String[] args)
---------------------------------------
[no name] 19-Feb-12 2:37am
   
thanks
See Pavel Chuchuva's answer on the same question that was asked on StackOverflow: http://stackoverflow.com/questions/169330/simple-way-to-programmatically-get-all-stored-procedures[^].

Regards,

Manfred
   
v2
Comments
thatraja 15-Feb-12 3:06am
   
5!
Manfred Rudolf Bihy 15-Feb-12 6:10am
   
Thank you! :)
[no name] 19-Feb-12 2:36am
   
thanks for this valuable link.

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