shole shole - 1 year ago 56
SQL Question

T-SQL select row if one specific column's decimal part is not 0

I have a table with one of the columns :

, it is of decimal type with 2 d.p.

Now I would like to select all rows from this table where
's decimal part is not 0

For example, I do not select the row if
is 150.00 or 222.00, but would like to select if
is 0.20 or 123.12, etc.

How can this be done in a single select query?

Answer Source

For rows where there is a zero decimal part Floor(cost) will equal cost and it won't where there is a non zero decimal part.

FROM YourTable
WHERE Floor(cost) <> cost;
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download