Site icon Dax Judy

CODE LIBRARY: SQL OpenQuery

I do a lot of data mining and OPENQUERY came in useful when querying servers with different versions of SQL Server. I have found that in some cases selecting from tables via Linked Servers returns errors if there are version incompatibilities. If that happens to you, try this bit of SQL…

SELECT * FROM OPENQUERY(LinkedServerName,’SELECT * FROM table WHERE column1 = ‘value1’) AS TableName

Exit mobile version