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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to insert data from local to remote?

Author  Topic 

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2010-04-15 : 12:49:40
How to insert data from local to remote like below?
(I tested but did not work)

insert * into [remote server].[northwind].orders
from [local server].[northwind].orders

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2010-04-15 : 13:07:37
You should be able to do this if you have a linked server relationship established AND you use a FOUR part name for the insert table. You are missing the SCHEMA portion of the name (e.g., [remote server].[northwind].orders should be [remote server].[northwind].DBO.orders). If you want to use the default schema, put nothing between the periods ([remote server].[northwind]..orders).

I am assuming that the target system is a SQL Server since the Northwind database is being used.

=======================================
A couple of months in the laboratory can save a couple of hours in the library. -Frank H. Westheimer, chemistry professor (1912-2007)
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2010-04-15 : 13:39:54
As Bustaz Kool says, but I tend to find that I run into trouble with Distributed Transactions when I do this and we have to fall back on using OPENQUERY for an INSERT (for which the syntax is ghastly and beggars belief!)
Go to Top of Page
   

- Advertisement -