Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
mauich123
Starting Member
21 Posts |
Posted - 2011-02-01 : 04:11:18
|
| Using a WHERE clause, how can I sort out float values ending with .01 ?I've tried to do it using LIKE but with no success. |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2011-02-01 : 04:13:42
|
| check if this works for you ...Where rtrim(str(FloatColumnName)) like '%.01'Cheers!MIK |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2011-02-01 : 04:29:08
|
where right(YourColumn,3) = '.01' No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
mauich123
Starting Member
21 Posts |
Posted - 2011-02-01 : 04:29:40
|
| Hi MIK,No, doesnt seem to work. I also checkedselect rtrim(str(total)) from table1 but it just removes the comma sign so I can't use it in my where-clause |
 |
|
|
mauich123
Starting Member
21 Posts |
Posted - 2011-02-01 : 04:30:45
|
quote: Originally posted by webfred where right(YourColumn,3) = '.01' No, you're never too old to Yak'n'Roll if you're too young to die.
This worked, thanks! |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
mauich123
Starting Member
21 Posts |
Posted - 2011-02-01 : 04:37:32
|
quote: Originally posted by Peso Oh man... FLOAT datatypes can be "73.010000000000000001" due to the way FLOAT is implemented from IE884.Use thisWHERE Col1 LIKE '%[,.]01%' because you cannot be sure the decimal sign is what you expect.See http://weblogs.sqlteam.com/peterl/archive/2011/01/14/some-datatypes-doesnt-honor-localization.aspx N 56°04'39.26"E 12°55'05.63"
Okay I see your point, but these values are deliberately set to .01 and the above "right(YourColumn,3) = '.01'" worked for my table where it's actually "," also. |
 |
|
|
|
|
|
|
|