| Author |
Topic |
|
sunrag77
Starting Member
8 Posts |
Posted - 2009-07-30 : 02:48:37
|
| HiIs it possible to copy one database table to another database. If yes, how, kindly help.RegardsSundaram |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-07-30 : 02:53:46
|
| ya possibleCopy only the schemaselect * into db2.dest_table from db1.source_table where 1=2Copy with dataselect * into db2.dest_table from db1.source_tableSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-07-30 : 02:59:20
|
quote: Originally posted by senthil_nagore ya possibleCopy only the schemaselect * into db2.dest_table from db1.source_table where 1=2Copy with dataselect * into db2.dest_table from db1.source_tableSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/
hi I think it should be like this...USE DB2SELECT * INTO <TABLE_NAME>FROM DB1..<TABLE_NAME>SELECT * FROM Database.schema.TableNameSELECT * FROM MASTER.DBO.SYSOBJECTS-------------------------R.. |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-07-30 : 03:03:18
|
| hi raj,for copying one database table to another database table u can use like this or u specified mention alsoselect * into db2.schemaname.tablename from db1.schemaname.tablename |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-07-30 : 03:03:32
|
quote: Originally posted by rajdaksha
quote: Originally posted by senthil_nagore ya possibleCopy only the schemaselect * into db2.dest_table from db1.source_table where 1=2Copy with dataselect * into db2.dest_table from db1.source_tableSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/
hi I think it should be like this...USE DB2SELECT * INTO <TABLE_NAME>FROM DB1..<TABLE_NAME>SELECT * FROM Database.schema.TableNameSELECT * FROM MASTER.DBO.SYSOBJECTS-------------------------R..
Both are Same!In your case you change the Database and execute the query.But i execute execute from the source DBSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-07-30 : 03:07:49
|
quote: Originally posted by senthil_nagore
quote: Originally posted by rajdaksha
quote: Originally posted by senthil_nagore ya possibleCopy only the schemaselect * into db2.dest_table from db1.source_table where 1=2Copy with dataselect * into db2.dest_table from db1.source_tableSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/
hi I think it should be like this...USE DB2SELECT * INTO <TABLE_NAME>FROM DB1..<TABLE_NAME>SELECT * FROM Database.schema.TableNameSELECT * FROM MASTER.DBO.SYSOBJECTS-------------------------R..
Both are Same!In your case you change the Database and execute the query.But i execute execute from the source DBSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/
its should be this...SELECT * INTO TEMPDB..#TEMP FROM Table_name-------------------------R.. |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-07-30 : 03:09:57
|
| HiCopy with dataselect * into db2.dest_table from db1.source_tableI think this will take schema not database.....-------------------------R.. |
 |
|
|
bklr
Master Smack Fu Yak Hacker
1693 Posts |
Posted - 2009-07-30 : 03:19:28
|
| hi raj we can use this select * into db2.schemaname.tablename from db1.schemaname.tablename it will work or USE DB2SELECT * INTO <TABLE_NAME>FROM DB1..<TABLE_NAME> |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-07-30 : 03:21:47
|
| Hi raj,if use specify the TEMPDB like u specifedSELECT * INTO TEMPDB..#TEMP FROM Table_nameIt says like thisDatabase name 'TEMPDB' ignored, referencing object in tempdb.Because "#" represent the Temp table so it automatically refer the Temp DataBase.Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-07-30 : 03:47:21
|
quote: Originally posted by bklr hi raj we can use this select * into db2.schemaname.tablename from db1.schemaname.tablename it will work or USE DB2SELECT * INTO <TABLE_NAME>FROM DB1..<TABLE_NAME>
hiBoth will work..we can use any one...right.. correct me if am in wrong..-------------------------R.. |
 |
|
|
sunrag77
Starting Member
8 Posts |
Posted - 2009-07-30 : 03:48:58
|
| Hi allThks for the reply, but my one database is in one server and another in my local.How will i copy this. Pls help. |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-07-30 : 03:50:35
|
quote: Originally posted by senthil_nagore Hi raj,if use specify the TEMPDB like u specifedSELECT * INTO TEMPDB..#TEMP FROM Table_nameIt says like thisDatabase name 'TEMPDB' ignored, referencing object in tempdb.Because "#" represent the Temp table so it automatically refer the Temp DataBase.Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/
Hiya i know ..here one of my local database name is tempdb1 instead of that i was put tempdb sorry....-------------------------R.. |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-07-30 : 03:53:44
|
quote: Originally posted by sunrag77 Hi allThks for the reply, but my one database is in one server and another in my local.How will i copy this. Pls help.
Hi1. use linked server select * into db2.schemaname.tablename from servername.db1.schemaname.tablename2.use Import and Export wizard3.use SSIS4.use openquery-------------------------R.. |
 |
|
|
|