August 25, 2009 at 10:16 am
How do I duplicate the structure (minus data) of my sql database? I want a friend to try it out. How can I preserve the structure AND data of some tables while duplicating only the structure of the others? Thx.
August 25, 2009 at 11:27 am
You can script out database by right clicking on the database -> tasks->generate scripts. you could also look into database publishing wizardhttp://www.microsoft.com/downloads/details.aspx?FamilyId=56E5B1C5-BF17-42E0-A410-371A838E570A&displaylang=en
August 25, 2009 at 11:30 am
To selectively move parts of the structure and parts of the data you will have to perform manual tasks to create something that can be transmitted. There are number of things you could do. For the structures, select the objects you want you could use the Generate Scripts wizard, accessed by right clicking on a db, selecting Tasks and then Generate Scripts.... To get data out selectively you could use the Import Export wizard. Again, go to the Tasks menu and select export data.
Other options include using SMO with a programming language such as C# or PowerShell to export scripts and then the data from the tables. You could also look at using SSIS to create a package to do the same thing.
Those are the first ones that come to mind.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
August 25, 2009 at 11:50 am
Lastly and most cheaply...
download SQL Toolbelt and use SQL Compare to build your schema & assign appropriate security, then use SQL Data Compare to fill up some tables. If you need fake data SQL Data Generator is the cheeks.
No, I don't work for redgate...
~BOT
Craig Outcalt
August 25, 2009 at 12:09 pm
SQLBOT (8/25/2009)
Lastly and most cheaply...download SQL Toolbelt and use SQL Compare to build your schema & assign appropriate security, then use SQL Data Compare to fill up some tables. If you need fake data SQL Data Generator is the cheeks.
No, I don't work for redgate...
~BOT
I don't work for them either and you're right. SQL Compare & SQL Data Compare could certainly do the job, and easier usually.
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
- Theodore Roosevelt
Author of:
SQL Server Execution Plans
SQL Server Query Performance Tuning
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply