Endelm
asked on
MSSQL 2005 - Decimal column query
Hi,
select mydecimalcolumn
from mytable
gives me:
10.05
4.25
4.5
4.0
How can I make a query that gives me data having a fracture more than 1 letter
10.05
4.25
Thank you.
select mydecimalcolumn
from mytable
gives me:
10.05
4.25
4.5
4.0
How can I make a query that gives me data having a fracture more than 1 letter
10.05
4.25
Thank you.
You can convert it into a char and select only those records whose string-length following the decimal point (.) is greater than 1.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try this.
select mydecimalcolumn
from mytable
where mydecimalcolumn*10 <> Round(mydecimalcolumn*10,0 )
select mydecimalcolumn
from mytable
where mydecimalcolumn*10 <> Round(mydecimalcolumn*10,0
select mydecimalcolumn
from mytable
where (mydecimalcolumn * 100) % 10 <> 0
from mytable
where (mydecimalcolumn * 100) % 10 <> 0
take that last one back. try this
select mydecimalcolumn
from mytable
where cast(mydecimalcolumn as decimal(10,1) <> mydecimalcolumn)
one op only, which is cast to 1dp, so should be quite fast
select mydecimalcolumn
from mytable
where cast(mydecimalcolumn as decimal(10,1) <> mydecimalcolumn)
one op only, which is cast to 1dp, so should be quite fast
Based On Imitchie's code,
select mydecimalcolumn
from mytable
where cast(mydecimalcolumn as decimal(10,1) < mydecimalcolumn)
sorry the mistake. i am take back my post
select mydecimalcolumn from Mytable
where len(mydecimalcolumn) - charindex('.', mydecimalcolumn) >= 2
where len(mydecimalcolumn) - charindex('.', mydecimalcolumn) >= 2