Linked Server NOT IN problem

Last Post 26 Sep 2006 01:30 PM by lmf232s. 1 Replies.
AddThis - Bookmarking and Sharing Button Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
lmf232s
New Member
New Member

--
26 Sep 2006 12:19 PM
Ok i have 1 table in sql server and another table in Oracle.

All i want to do is say select * From SQL Where Not In Oracle.
Pretty simple query but it wont work. Here is my query.

SELECT OperatorId
FROM Qc_InprocessOperators
WHERE OperatorId NOT IN
(
SELECT Emp_Num
FROM OpenQuery(Glovia, '
SELECT Emp_Num
FROM Glovia_Prod.Employee
WHERE User_Alpha1 = ''430'' Or User_Alpha1 = ''1-43''
')
)
ORDER BY OperatorId

The first query if ran by its self returns 141 records
The second query if ran by its self returns 138 records.
The above statement should return 3 records but it keeps returning 141 records.

If i change the query to IN instead of NOT IN i then get 138 records.

I did create a table in sql server and populate the table with the 2nd query data and then tried the above query but instead of the 2nd query reading from oracle it was reading from sql. IT WORKED FINE.

So again im stumped. Im not sure what else to look at. Its not like i have never done this before with sql and oracle.

The only difference that i can find is that in sql the datatype is Varchar(10) and in Oracle its Varchar2(10).

Im not sure if this is causing the problem or not.

Does any 1 have an idea of what could be wrong here?

Thanks.
lmf232s
New Member
New Member

--
26 Sep 2006 01:30 PM
Damn, now that i look at it i cant believe i did not see that earlier.
I had tried something similar to that with no such luck.

Your the man Russellb!
You are not authorized to post a reply.

Acceptable Use Policy