Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select into from one sql server into another?

I want to select data from one table (T1, in DB1) in one server (Data.Old.S1) into data in another table (T2, in DB2) in another server (Data.Latest.S2). How can I do this ?

Please note the way the servers are named. The query should take care of that too. That is, SQL server should not be confused about fully qualified table names. For example - this could confuse SQL server - Data.Old.S1.DB1.dbo.T1.

I also want "mapping" . Eg Col1 of T1 should go to Col18 of T2 etc.

like image 327
Steam Avatar asked Oct 18 '13 21:10

Steam


1 Answers

create a linked server. then use an openquery sql statement.

like image 77
Charles Bretana Avatar answered Sep 18 '22 23:09

Charles Bretana