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)
 openquery

Author  Topic 

psangeetha
Yak Posting Veteran

95 Posts

Posted - 2013-02-12 : 14:57:00
Hi friends,

We are troubleshooting a performance issue, would like to know if the below sql can be written via openquery..

SELECT localtab.field1 FROM LINKEDSERVER..REMOTEUSER.TABLE remtab, localtab
WHERE ((remtab.rfield1 = 'value' OR remtab.rfield1 = 'value' ) OR (remtab.rfield2 = 'value' ))
AND remtab.rfield3 = localtab.rfield3

Please help.. Any help is greatly appreciated.. Thanks

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-13 : 04:39:57
you can

SELECT l.field1
FROM OPENQUERY(LINKEDSERVER,'SELECT * FROM LINKEDSERVER..REMOTEUSER.TABLE
WHERE rfield1 = ''value'' OR rfield1 = ''value'' OR rfield2 = ''value''') r
JOIN localtab l
ON r.rfield3 = l.rfield3


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -