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

Is it possible to create a script that will generate a create table script for all tables in a database at once? Expand / Collapse
Author
Message
Posted Friday, November 9, 2012 11:09 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, July 18, 2014 1:57 PM
Points: 313, Visits: 715
Say I have a database called MyDB with 100 tables. I need to create these tables on another db. Is there a TSQL script that will return the create table scripts for all tables on MyDB?
Post #1383156
Posted Friday, November 9, 2012 11:24 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, July 18, 2014 1:57 PM
Points: 313, Visits: 715
I ended up using the Transfer SQL Server Objects task in ssis to copy the tables over without the data which is exactly what I needed.
Post #1383164
Posted Friday, November 9, 2012 11:27 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Today @ 7:51 PM
Points: 3,354, Visits: 7,251
In SSMS you can right click on the database and use Tasks-> Generate Scripts...
That will give you plenty of options to generate the scripts for all or some of the objects of your database.



Luis C.
I am a great believer in luck, and I find the harder I work the more I have of it. Stephen Leacock

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1383165
Posted Monday, November 12, 2012 2:22 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, July 23, 2014 8:48 AM
Points: 1,118, Visits: 1,582
You can use the Genereate Scripts option as shown in the following link:

Generating Scripts in sql server


Vinu Vijayan

For better and faster solutions please check..."How to post data/code on a forum to get the best help" - Jeff Moden
Post #1383558
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse