Solved

Openquery and where clause

Posted on 2003-11-03
3
979 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
  • 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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

Let's review the features of new SQL Server 2012 (Denali CTP3). It listed as below: PERCENT_RANK(): PERCENT_RANK() function will returns the percentage value of rank of the values among its group. PERCENT_RANK() function value always in be…
Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

809 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