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

Generating Scripts for Database Objects Expand / Collapse
Author
Message
Posted Friday, April 24, 2009 8:17 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Yesterday @ 9:59 AM
Points: 304, Visits: 574
Hi,

I was wondering if anyone can help me figure out a way to script out all the database objects to separate files. For example a sql file for each:

Stored Procedure
Function
Trigger
View
etc

The problem is that Generating the scripts from EM wont let me create a separate file for each trigger they all end up table defintion files.

Any ideas?




MCITP SQL 2005, MCSA SQL 2012
Post #703982
Posted Friday, April 24, 2009 8:46 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Yesterday @ 4:56 PM
Points: 31,168, Visits: 15,612
The trigger can't exist without the table, so I think it's a dependent object that goes in there. You ought to be able to get the others as separate files.

The triggers just need to be manually separated out.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #704024
Posted Monday, April 27, 2009 3:08 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Yesterday @ 9:59 AM
Points: 304, Visits: 574
After playing about with all the options in EM I have managed to do this.

It created them all with the file extension .TRG I then used a freeware application to change all the extensions to .sql.

Just need to keep trying to see if I can get it to do the same with Primary and Foreign keys etc.

Thanks anyway.

R


MCITP SQL 2005, MCSA SQL 2012
Post #704780
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse