Wednesday, March 21, 2012

Problem with Simple Query

Hi

I'm executing the following query on table OMS_SITEVISIT_ITEMLIST, and it just ain't working. I have tested this in Enterprise Manager.

SELECT *
FROM OMS_SITEVISIT_ITEMLIST
WHERE (eFolderID = 'LAPTOP$LAPTOP$00000956')
AND (InStock <> - 1)

I have 3 rows where eFolderID = 'LAPTOP$LAPTOP$00000956' and InStock is NULL. So in theory it should pull back 3 rows, but it doesn't pull any. It does pull back 3 rows if i remove the reference to InStock (which is of type SMALLINT, length 2), so it's the second part of the WHERE clause that's causing the problem.

Can anyone see where I might be going wrong?

Cheers
GregTry this lets see...

SELECT *
FROM OMS_SITEVISIT_ITEMLIST
WHERE (eFolderID = 'LAPTOP$LAPTOP$00000956')
AND isNull(InStock, Null) = Null|||I've come up with a workaround, and done away with the check on -1, but on 0 or NULL.

Thanks

No comments:

Post a Comment