Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
kurtgr
Starting Member
25 Posts |
Posted - 2009-06-23 : 12:02:56
|
| Hello all I would like to copy a table and it contents from one database to another. Can someone tell me which is the best way in achieving this?Thanks in advance |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-06-23 : 12:04:18
|
select * INTO database2..table from database1..table No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
kurtgr
Starting Member
25 Posts |
Posted - 2009-06-23 : 12:27:57
|
| Thanks for your answer but would this be after i have created the table structure in the other database?Thnks again in advance |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-06-23 : 12:30:33
|
No.This kind of insert requires that the destination table does NOT exist. No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
kurtgr
Starting Member
25 Posts |
Posted - 2009-06-23 : 12:44:55
|
| Ok Thanks again it worked |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2009-06-23 : 12:51:24
|
welcome  No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-06-24 : 02:04:30
|
| Note that if you want to have indices in the target table, generate script;create table;copy tableMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|