views:

22

answers:

2

I have a column that is currently a floating-point number and I need to check if all the values in the column are integers. What's the easiest way to do this?

+2  A: 
SELECT COUNT(*) FROM yourtable WHERE ceil(yourcolumn) != yourcolumn

If the count > 0 then there are non-integer values.

Andy West
+1  A: 

And to specifically find the records that are not integers...

SELECT * from yourtable WHERE col % 1 != 0;
nullptr