VB Script to script all stored procedures

VB Script to script all stored procedures

Post by Steve » Sun, 16 Nov 2003 01:05:48



I need a VB script that will script all user created
database stored procedures and apply them to another
database.

Thank You,

Steven

 
 
 

VB Script to script all stored procedures

Post by Ben Taylo » Sun, 16 Nov 2003 02:36:02


I should add that it's written as a full-blown VB .exe rather than VBScript.


Quote:

> I need a VB script that will script all user created
> database stored procedures and apply them to another
> database.

> Thank You,

> Steven


 
 
 

VB Script to script all stored procedures

Post by Ben Taylo » Sun, 16 Nov 2003 02:35:36


I have written a VB program that does exactly that. Let me know your email
address and I'll send it to you on Monday. It also generates an SQL file for
backup of the structure if required. The only thing to watch if that if
certain SPs rely on other SPs, they might not appear in the correct order in
the file, so you might need to rearrange bits or run it twice on the target.
Another way that I have also implemented for backup of structure purposes
should the server's hard disk fail and that you may also want to think about
doing, is to set up a DTS package that transforms the following queries into
Access:
select distinct name, id, xtype from sysobjects
select distinct id, text from syscomments
Use a date field in Access with a defualt of Now(), so you can schedule it
and pick out a certain day's backup if required.
For this method, you'll need to specify the exact network path of the Access
database as the server might not understand the client's drive mappings, and
that if you convert it to a Visual Basic file (for converting to an .exe for
scheduling) you need to go through and put the password in.
Hope this helps


Quote:

> I need a VB script that will script all user created
> database stored procedures and apply them to another
> database.

> Thank You,

> Steven