Solved

Openquery and where clause

Posted on 2003-11-03
3
987 Views
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

Thanxs,
Glass


0
Comment
Question by:Glass
[X]
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
3 Comments
 
LVL 3

Accepted Solution

by:
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.
0
 

Author Comment

by:Glass
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.

Glass
0
 

Author Comment

by:Glass
ID: 9675183
htarlow,

You pointed me in the right direction...

Thanxs,
Glass
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.

707 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