Solved

Openquery and where clause

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
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…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now