What is the advantage of Sql Data Type numeric?
What is the advantage of Sql numeric data type ( like numeric(10,2)). What is the difference between开发者_Python百科 decimal and numeric? And also what is the type match in .net for numeric?
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.
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
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.
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.
精彩评论