类型映射

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的更多相关文章

  1. sql server中常用方法函数

    SQL SERVER常用函数 1.DATEADD在向指定日期加上一段时间的基础上,返回新的 datetime 值. (1)语法: DATEADD ( datepart , number, date ) ...

  2. 五、Sql Server 基础培训《进度5-数据类型(知识点+实际操作)》

    知识点: ================================================= ============================================= ...

  3. SQL Server 获取服务器信息

    最近做了一个小工具,里面涉及到一些取SQL Server 服务器信息的一些东西,找了好久,找到一个不错的,贴出来分享. 系统函数 SERVERPROPERTY ( propertyname ) 包含要 ...

  4. SQL Server中临时表是在什么schema下的(转载)

    Specifying schema for temporary tables 问: I'm used to seeing temporary tables created with just the ...

  5. 手工注入——sql server (mssql)注入实战和分析

    前言 首先要对sql server进行初步的了解.常用的全部变量@@version:返回当前的Sql server安装的版本.处理器体系结构.生成日期和操作系统.@@servername:放回运行Sq ...

  6. sql server数据库中 smallint, int ,bigint ,tinyint的区别与长度

    smallint  是一种精确的数值数据类型,其精度在算术运算后不变,采用2个字节编码 有符号的 smallint 值的范围是 -2^15-------2^15 -1,即 -32768 ----327 ...

  7. SQL server数据类型int、bigint、smallint、tinyint

    1. 整数类型 int.bigint.smallint.tinyint 数据类型 范围 存储 bigint -2^63 (-9,223,372,036,854,775,808) 到 2^63-1 (9 ...

  8. SQL Server数据类型int、bigint、smallint、tinyint对比表

    SQL Server数据类型int.bigint.smallint.tinyint对比表 数据类型 范围 存储 bigint -2^63 (-9,223,372,036,854,775,808) 到 ...

  9. sql server like 在将值转换成数据类型int失败

    select * from table where title like '%'?'%'; 采用? 传参会报错:sql server like 在将值转换成数据类型int失败 select * fro ...

随机推荐

  1. WinServer-IIS-压缩及缓存

    静态内容压缩: 默认10s内有2个客户端一起请求服务器的话,服务器就会把相关的静态内容压缩返回 动态内容压缩: 默认IIS的程序域最高可以占用CPU90%的资源,这个可以通过命令行修改 缓存和内核缓存 ...

  2. HDU 2421

    由算术基本定理N=p1^e1*p2^e2....ps^es,可知一个素的因子个数为(e1+1)*(e2+1)*...*(es+1). 而N的一人因子必定也有n=p1^k1*p2^k2....*ps^k ...

  3. 开发者了解NET的15个特性

    NET 开发者了解的15个特性 本文列举了 15 个值得了解的 C# 特性,旨在让 .NET 开发人员更好的使用 C# 语言进行开发工作. ObsoleteAttribute ObsoleteAttr ...

  4. su和sudo的区别与使用,su命令,linux命令

    su和sudo的区别与使用 一.   使用 su 命令临时切换用户身份 1. su 的适用条件和威力 su命令就是切换用户 的工具,怎么理解呢?比如我们以普通用户beinan登录的,但要添加用户任务, ...

  5. BZOJ 2194 FFT

    思路: 题目中给的是差值一定的 那么就把b数组倒一下 不就变成 i+j=k(k为定值的了嘛) 嗯 然后搞个FFT //By SiriusRen #include <cstdio> #inc ...

  6. Aspose office (Excel,Word,PPT),PDF 在线预览

    前文: 做个备份,拿的是试用版的 Aspose,功能见标题 代码: /// <summary> /// Aspose office (Excel,Word,PPT),PDF 在线预览 // ...

  7. 持久层框架Clone

    Clone框架:http://www.52chloe.com/Wiki/Document/3324802610879266816 Clone框架支持多种数据库,我用的是sql server 基本查询: ...

  8. 最长公共子序列(稀疏序列)nlogn解法

    首先这种做法只能针对稀疏序列, 比如这种情况: abc abacabc. 会输出5 ,,,,就比较尴尬, #include<iostream> #include<cstdio> ...

  9. jquery获取焦点和失去焦点

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/ ...

  10. 利用IP安全策略关闭危险端口

    默认情况下,Windows服务器有很多端口是开放的,网络病毒和黑客可以通过这些端口连上你的服务器并进行攻击. 为了让你的系统变为铜墙铁壁,应该封闭这些端口,主要有:TCP 135.139.445.59 ...