码迷,mamicode.com
首页 > 数据库 > 详细

numeric and int in sql server

时间:2017-09-19 17:49:28      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:class   not   synonym   var   syn   default   ble   rmi   sha   

类型映射

https://docs.microsoft.com/en-us/dotnet/framework/data/adonet/sql-server-data-type-mappings

 

C#关键字

decimal 

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/decimal

The decimal keyword indicates a 128-bit data type.

Compared to other floating-point types, the decimal type has more precision and a smaller range, which makes it appropriate for financial and monetary calculations.

The approximate range and precision for the decimal type are shown in the following table.  

取值范围(-7.9 x 1028 to 7.9 x 1028) / (100 to 1028)

精度28-29 significant digits

 

int

https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/int

int denotes an integral type that stores values according to the size and range shown in the following table.  

取值范围-2,147,483,648 to 2,147,483,647

大小Signed 32-bit integer

 

 

SQL Server中

https://docs.microsoft.com/en-us/sql/t-sql/data-types/decimal-and-numeric-transact-sql

Numeric data types that have fixed precision and scale. Decimal and numeric are synonyms and can be used interchangeably.

decimal[ (p[ ,s] )] and numeric[ (p[ ,s] )]
Fixed precision and scale numbers.

When maximum precision is used, valid values are from - 10^38 +1 through 10^38 - 1.

The ISO synonyms for decimal are dec and dec(p, s).

numeric is functionally equivalent to decimal.

 

p (precision)

The maximum total number of decimal digits that will be stored, both to the left and to the right of the decimal point.

The precision must be a value from 1 through the maximum precision of 38. The default precision is 18.

 

s (scale)

The number of decimal digits that will be stored to the right of the decimal point.

This number is subtracted from p to determine the maximum number of digits to the left of the decimal point.

The maximum number of decimal digits that can be stored to the right of the decimal point.

Scale must be a value from 0 through p.

Scale can be specified only if precision is specified.

The default scale is 0; therefore, 0 <= s <= p.

Maximum storage sizes vary, based on the precision.

 

Example

numeric(18,2)的取值范围

最大9999999999999999.99  小数点右边两位数字,左边16位数字

 

numeric and int in sql server

标签:class   not   synonym   var   syn   default   ble   rmi   sha   

原文地址:http://www.cnblogs.com/chucklu/p/7552728.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!