try this:
INSERT INTO tablename
SELECT * FROM OPENROWSET
('SQLOLEDB',
'Trusted_Connection=yes;Server=SERVERNAME','SELECT Num1, Num2, Num3 FROM [DBName].[dbo].TableName)')
Domanda
I want to send data across from one server to another, I wish to improve my performance and wondered if OpenQuery is a good route to go down?
I tried to do something like this;
INSERT INTO OPENQUERY (SERVERNAME, '(SELECT Num1, Num2, Num3 FROM [DBName].[dbo].TableName)')
(Num1, Num2, Num3)
SELECT Num1, Num2, Num3
FROM #Temp
However this returns the error
The provider indicates that conflicts occurred with other properties or requirements.
I don't understand this as the query does run fine and produce the required results without OpenQuery...
Could any of you advise me on this please?
Soluzione
try this:
INSERT INTO tablename
SELECT * FROM OPENROWSET
('SQLOLEDB',
'Trusted_Connection=yes;Server=SERVERNAME','SELECT Num1, Num2, Num3 FROM [DBName].[dbo].TableName)')