question

Rashi avatar image
Rashi asked

how to insert into temp table from openquery linked server table

select * into #t1 from OPENQUERY(LINKACTIVEWF, 'select * from tmp_vmi')
inserttemporary-tableopenquery
3 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

SirSQL avatar image SirSQL commented ·
Cross server joins are going to be incredibly slow and painful. You have to factor in network latency, a lack of statistics and it having to pull the whole dataset back to then filter out the information that you want. I would recommend a rewrite, get all the data in one place first.
3 Likes 3 ·
JohnM avatar image JohnM commented ·
Forgive me, but what's the question? Is the code you listed not working? Any error messages? I was able to use your code against a linked server in my environment and didn't have any issues. If you can post further details that would be most helpful!
0 Likes 0 ·
Rashi avatar image Rashi commented ·
Hi.. Actually I want to insert the "data" into "linkedserver table" which not exists in the temporary table data after do the comparision with the temporary table and the linked server table. My Query Is like insert into openquery(linkedserver,'Select * from table') select distinct * from #temp where price=1 and rate=1 what I want now the data which exists in linkedserver table should not go from #temp table. so I try this later on insert into openquery(linkedserver,'select * from table') select distinct * openquery(linkedserver,'select * from table')a,#temp b where a.code<>b.code and a.name<>b.name but when I am executing its execute for long taking so much tym.. Please suggest some better solution
0 Likes 0 ·

0 Answers

·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.