Thursday, March 29, 2012

Copy just the Database Structure not the Data

I have been working on my windows app, using SQL Server 2005 (& C#) but I now have loads of junk data, so I want to copy the structure without any data to a new set of files that can become the production version.

I assume I can use backup and restore in future when I want a copy of my production data to use for future testing.

How would I take just one table from my test database and add it to my production database without retyping the design?

Apart from the size limitation is there any advantage in buying a version of SQL Server over using the Express edition?

hi,

GrahamY wrote:

I have been working on my windows app, using SQL Server 2005 (& C#) but I now have loads of junk data, so I want to copy the structure without any data to a new set of files that can become the production version.

you can script out the metadata using SQL Server Management Studio Express, but this still works for 1 object at the time...

or you can have a look at this toolkit for a more comprehensive generation "wizard"..

or, you can have a look at 2 free prjs of mines, amScript and amInsert that can produce DDL scripts as long as INSERT INTO scripts to populate existing tables...

then you can execute the DDL script to create a db "clone"....

I assume I can use backup and restore in future when I want a copy of my production data to use for future testing.

backup/restore feature can be handy, but not if you want to only have an "empty" database..

How would I take just one table from my test database and add it to my production database without retyping the design?

see above..

Apart from the size limitation is there any advantage in buying a version of SQL Server over using the Express edition?

the full blown editions offer other "features" missing in Express editions as the complete SSIS integration, BI tools and features, mirroring features, more cpu support, more ram support ... http://www.microsoft.com/sql/prodinfo/features/compare-features.mspx

regards

No comments:

Post a Comment