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 |
amirs
Constraint Violating Yak Guru
260 Posts |
Posted - 2010-10-30 : 02:56:32
|
Dear Memberi have select a records in table in condition is one colom is not equal to 0 . the column data type is float.the one row of this column is 0. but i have select row their is some value display like 2.91038304567337E-11 but actual value is 0i have write following queryselect col1,col2 from tabl where col3 <> 0 so please tell me how write query doesn't display this type of records |
|
Kristen
Test
22859 Posts |
Posted - 2010-10-30 : 03:43:47
|
Float will only store an approximation of your number (in many cases). Use DECIMAL datatype if you want an accurate number stored (or MONEY if you are storing monetary values).You can ROUND your FLOAT column to a specific number of decimal places, and compare that to zero for improved accuracy.Note that you are comparing col3 of type float with an integer 0, you should use:select col1,col2 from tabl where col3 <> 0.owhen making a float point comparison against a constant value. |
|
|
|
|
|