views:

48

answers:

1

Somewhere in the midst of thousands of records I have a decimal value in a sql column that has an odd value.

Specifically, it has a decimal place of .002.

The actual amount could be pretty much anything like 238.002 or 543.002

So how can I write a query to find that?

+1  A: 

How about something like this:

SELECT *
FROM myRows
WHERE (myVal - CAST(myVal AS INTEGER)) = 0.002;

Although, from the sound of it, it sort of smells like maybe you're storing your decimal values as FLOATs instead of NUMERIC or DECIMAL, which will cause errors of a whole different nature.

Dave Markle
bingo. Thanks.
Chris Lively

related questions