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 |
anupalavila
Yak Posting Veteran
56 Posts |
Posted - 2008-12-03 : 05:54:43
|
Hai How can I transfer a table from database DB1 to another database DB2 along with the data in it. Usually I use to generate sqlscript of the table and run in other database but now I need also the data in it, Is there any way like generating sqlscript together with the data in itThanks and Regards Anu Palavila |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2008-12-03 : 07:45:30
|
You can do like this:select * into db2..table1from db1..table1The target table then is created by the query. You have to alter table for missing indexes etc.or you can use DTS-Package, there is task to copy server objects.GreetingsWebfred No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-03 : 09:16:30
|
Are dbs in same server? if yes,use webfred's soln. else,either add them as linked server and useselect * into server2.db2..table1from server1.db1..table1 else use OPENROWSET |
 |
|
anupalavila
Yak Posting Veteran
56 Posts |
Posted - 2008-12-03 : 23:25:24
|
no the dbs are on different servers one in my local machine and the other in a hosting server where I use to host my websiteThanks and Regards Anu Palavila |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-04 : 02:16:54
|
quote: Originally posted by anupalavila no the dbs are on different servers one in my local machine and the other in a hosting server where I use to host my websiteThanks and Regards Anu Palavila
then try my last suggestion |
 |
|
|
|
|