Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 123»»»

How to Export Stored Procedures to Text Files? Expand / Collapse
Author
Message
Posted Sunday, July 31, 2005 5:28 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, September 13, 2007 2:10 AM
Points: 21, Visits: 1

I have over 100 Stored Procedures in my database and would like to know how to export them to text files as a backup? (Not the output data of the Stored Procedure, but the Stored Procedure itself.)

Please help! Thank you

 

 

Post #205892
Posted Sunday, July 31, 2005 7:32 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 12:59 PM
Points: 2,555, Visits: 605
Nisha - you can use enterprise manager and the scripting wizard to script the text either into individual files or all stored procedures in one big file and then print them out!

if you right click on the database - go to "all tasks" - generate sql scripts - you can then enter your specs in each tab...under the options tab you can check either the "create one file" or "create one file per object"!

hth!








**ASCII stupid question, get a stupid ANSI !!!**
Post #205894
Posted Sunday, July 31, 2005 8:09 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 5:35 AM
Points: 6,733, Visits: 8,485

Check uot SQLDMO is BOL.

It has scripting capabilities.



Johan


Don't drive faster than your guardian angel can fly ...
but keeping both feet on the ground won't get you anywhere

- How to post Performance Problems
- How to post data/code to get the best help


- How to prevent a sore throat after hours of presenting ppt ?


"press F1 for solution", "press shift+F1 for urgent solution"


Need a bit of Powershell? How about this

Who am I ? Sometimes this is me but most of the time this is me
Post #205898
Posted Sunday, July 31, 2005 8:09 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: 2 days ago @ 5:35 AM
Points: 6,733, Visits: 8,485

Check uot SQLDMO is BOL.

It has scripting capabilities.



Johan


Don't drive faster than your guardian angel can fly ...
but keeping both feet on the ground won't get you anywhere

- How to post Performance Problems
- How to post data/code to get the best help


- How to prevent a sore throat after hours of presenting ppt ?


"press F1 for solution", "press shift+F1 for urgent solution"


Need a bit of Powershell? How about this

Who am I ? Sometimes this is me but most of the time this is me
Post #205899
Posted Sunday, July 31, 2005 9:45 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, September 13, 2007 2:10 AM
Points: 21, Visits: 1

Sushila, Thanks a ton! I hadn't explored the option you mentioned.

It worked and I've gained more SQL knowledge. Thank U once again

Post #205905
Posted Sunday, July 31, 2005 9:57 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 12:59 PM
Points: 2,555, Visits: 605
anytime!







**ASCII stupid question, get a stupid ANSI !!!**
Post #205907
Posted Sunday, July 31, 2005 10:36 PM


Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, October 21, 2014 1:27 AM
Points: 14, Visits: 197

for an instance you can do it other alternet way too use L:

sp_helptext 'yrspname'  it will display the text / code of yr sp copy / save it to .txt file .

HTH

Regards.

 



Hemantgiri S. Goswami | SQL Server Specialist & Consultant
SQL Server Citation | Follow me on Twitter
Post #205954
Posted Tuesday, December 11, 2007 4:55 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Wednesday, June 8, 2011 5:32 AM
Points: 6, Visits: 21
Following up on the solution provided by Sushila, is there a way to script all stored procedures in the database to seperate files with the same names as the stored procedures?

This is driving me nuts. The method provided by Sushila can script the SPs to a file one by one or all at once in a single file, but can I do all of them together in seprate files with the same names as original.
Post #432091
Posted Wednesday, December 12, 2007 1:39 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, May 1, 2014 12:48 AM
Points: 292, Visits: 810
From within SQL-EM, highlight the list of stored procedures within the database.
After right click and choosing Tasks-->Generate SQL Scripts, the "Generate SQL Scripts" window appears.
the [General] tab will show those objects to be scripted
switch to the [Options] tab. The bottom right corner has an option to script all selected objects as one file or one file per object.

When you click the OK button it will ask for the folder into which each file will be saved. stored procedures will have a .PRC extension
-----
Robert



Post #432175
Posted Wednesday, December 12, 2007 5:39 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 12:59 PM
Points: 2,555, Visits: 605
In addition to Robert's post I just wanted to mention that the Help provided with SQL Server (BOL - Books on line) is pretty extensive & comprehensive and that's usually the first place I would look for solutions!:)







**ASCII stupid question, get a stupid ANSI !!!**
Post #432245
« Prev Topic | Next Topic »

Add to briefcase 123»»»

Permissions Expand / Collapse