views:

3938

answers:

3

Hi, I searched in google and also visited the

decimal and numeric and SQL Server Helper

to glean the difference between numeric , float and decimal datatypes and also to find out which one should be used in which situation.

For any kind of financial transaction, which one is prefered and why? e.g. for salary field

+2  A: 

Thanks I got the answer from this site

SQL SERVER – Difference and Explanation among DECIMAL, FLOAT and NUMERIC

priyanka.sarkar
+1  A: 

Decimal has a fixed precision while float has variable precision.

EDIT (failed to read entire question): Float(53) (aka real) is a double-precision (32-bit) floating point number in SQL Server. Regular Float is a single-precision floating point number. Double is a good combination of precision and simplicty for a lot of calculations. You can create a very high precision number with decimal -- up to 136-bit -- but you also have to be careful that you define your precision and scale correctly so that it can contain all your intermediate calculations to the necessary number of digits.

Brian Reiter
You did not specify which is preferable while the case goes for financial transaction and why?
priyanka.sarkar
A: 

Not a complete answer, but a useful link:

"I frequently do calculations against decimal values. In some cases casting decimal values to float ASAP, prior to any calculations, yields better accuracy. "

http://sqlblog.com/blogs/alexander_kuznetsov/archive/2008/12/20/for-better-precision-cast-decimals-before-calculations.aspx

AlexKuznetsov