Steam Steam - 1 month ago 21
SQL Question

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.

Answer

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