• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 365
  • Last Modified:

Copy columns from one table and database to another table and database

Hello

Is there any  short way to copy  a table with no data (just columns) from one database to another table from another database using MSSQL 2008?

I tried doing design table, and than on Edit, i selected copy the columns but when I go to add a new table on another database and paste the columns, it does pasta all row fields in one row. Is there anything I am doing wrong.

thank you
0
shpresa
Asked:
shpresa
1 Solution
 
Walter PadrónCommented:
Open SSMS and right-click over the desired table, then Script table as .. / DROP and CREATE To / Clipboard
and you have a script that recreate the table.

Best regards
0
 
SimonCommented:
Use SSMS.
1.Right click the source table and choose script /create to new query window
2.Go to the top of the query window and insert the following line (or select the desired database in the combobox)
Use destinationdatabase
3. Execute the script

Or a really basic way...
use sourcedb
select *
into destinationdatabase.schemaname.tablename
from sourcetable
where 1=2
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now