Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to copy structure of database in another database in sql server 2008? [closed]

i have a database and want to copy all the tables in new database without copying the dat of all those tables only structure should be copy

like image 627
user1987047 Avatar asked Jan 17 '13 12:01

user1987047


People also ask

How do I copy a table structure from one database to another in SQL Server?

Launch SQL Server Management Studio. Select and right-click on the Source Database, go to Tasks > Export Data. Import/Export Wizard will be opened and click on Next to proceed. Enter the data source, server name and select the authentication method and the source database.

How do I copy a SQL Server database diagram?

To copy a diagram image to the Clipboard Open a Database Diagram. Only the owner of the diagram or a member of the db_owner role of the database can open the diagram. Right-click a blank area and choose Copy Diagram to Clipboard. The image of the entire Database Diagram is now in the system Clipboard.


1 Answers

SQL Server Management Studio offers the following:

Scripting the whole database:

  • Under the Object Explorer, right mouse click on the database and then select Script Database as

To script just (specific) tables:

  • In Object Explorer, right mouse click on the database, select Tasks, then Generate Scripts, and then select the tables that you want.

You can then use the script to create a new database / new objects elsewhere. If you change the name of the database, remember to change the USE xxx statement(s) accordingly.

like image 134
StuartLC Avatar answered Nov 15 '22 08:11

StuartLC