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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Datatype Fields

Author  Topic 

karthickbabu
Posting Yak Master

151 Posts

Posted - 2009-04-16 : 01:40:15

Is there any difference between comparing two float datatype columns and Numeric datatype columns. Because, In my queries using numeric datatype then it works properly. When i use float then it doesn't compares two columns like as below

1) Column1 > column2
2) Column1 = Column2

The same coondition used in numeric columns it works properly.

Any idea about this?



====================================================
you realize you've made a mistake, take immediate steps to correct it.

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-04-16 : 02:49:44
No, there is no difference.
But beware that the stored value may not 100% represent the value you updated or inserted.
I am currently writing on an article describing the drawbacks of using FLOAT datatype.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-04-16 : 11:00:27
that may be because float is just an approximate value and precision wont be same while comparison. its always better to use exact numerical datatypes like numeric,decimal if you want to perform comparisons like above
Go to Top of Page
   

- Advertisement -