Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy table structure from one database to another

Status
Not open for further replies.

FarzanaSaleem

Programmer
Jun 17, 2003
63
PK
In the SQL Server Enterprise Manager, two databases are defined in Console Root-> Microsoft SQL Servers -> SQL Server Group -> ServerName -> Databases. Names of Databases are ABCLIVE and ABCTEST. In ABCTEST, tables are defined and data is present in these tables. In ABCLIVE only database is defined with no tables. I want to copy the structure of tables in ABCTEST to ABCLIVE. (I need to copy only structure and not data)
 
Right-click the table in Ent Mgr and go to All Tasks -> Generate SQL Script. In the Formatting tab you can choose whether you need to script a DROP statement first (probably not in your case). In the Options tab you can choose to script other objects as well, such as indexes or primary keys etc.

Once you have generated the script you can simply execute it from the live db and create the table.

--James
 
hi
an other way ( visial )
1.right click any where Console Root-> Microsoft SQL Servers -> SQL Server Group -> ServerName -> Databases
2.click All Task -> Import Data
3.continue wizard
i. define data source
ii. define destination database
iii.one click more
iv. select tables and views that you want
v. finish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top