Openquery and where clause

Posted on 2003-11-03
Last Modified: 2007-12-19
Would like help to query a view for data using openquery on a machine running Win2k server and SQL server 2000.  The remote machine is running Oracle 816.  

My general download query works:

select * from openquery(LinkServer, 'select * from tbl_name')

Would like to add a where clause->    where col_name like "2003%"  but erroring out with doesn't recognize column.  Have tried various combinations of naming but to no avail.  

Oracle DB
Schema -> Enterprise
table owner for remote db -> unknown
userid for remotedb -> user_id
table name -> tbl_name
column name -> col_name


Question by:Glass
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Accepted Solution

htarlow earned 250 total points
ID: 9675053
is your where condition within the openquery or after it?

Placing the condition within the query causes the filtering to be performed on the remote server.
If you place the condition after the openquery, all data is returned and then filtering is done by sqlserver.

Author Comment

ID: 9675088
I have tried both ways.  If within, the query returns the column is unknown.  If outside, then the query fails to return and timesouts.


Author Comment

ID: 9675183

You pointed me in the right direction...


Featured Post

Backup Solution for AWS

Read about how CloudBerry Backup fully integrates your backups with Amazon S3 and Amazon Glacier to provide military-grade encryption and dramatically cut storage costs on any platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Nowadays, some of developer are too much worried about data. Who is using data, who is updating it etc. etc. Because, data is more costlier in term of money and information. So security of data is focusing concern in days. Lets' understand the Au…
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question