Reputation: 3026
What is the advantage of Sql numeric data type ( like numeric(10,2)). What is the difference between decimal and numeric? And also what is the type match in .net for numeric?
Upvotes: 4
Views: 1706
Reputation: 8508
The numeric datatype is a fixed precision type. The advantage over float is that you know exactly how many decimal digits you have, with no approximation (with too big or too small numbers) so you can have correct significative figures.
Decimal and Numeric are the same type in TSQL.
In .NET the matching type for numeric should be decimal
Upvotes: 3
Reputation: 346260
According to the SQL standard (at least the SQL-92 draft that can be found on the web), the only difference is that NUMERIC(N,M)
has exactly M total digits, while DECIMAL(N,M)
is allowed to have more than M digits.
Upvotes: 2
Reputation: 12704
from BOL
decimal and numeric:
decimal
- Fixed precision and scale numeric data from -10^38 +1 through 10^38 –1.
numeric
- Functionally equivalent to decimal.
Upvotes: 1
Reputation: 66
AFAIK they are synomyms as far as TSQL is concerned. Re .NET; the only direct equivalent is SqlNumeric; decimal
comes close, but doesn't have the same range etc.
Upvotes: 5