How to check sqlsever table data type identity status ?
Unlike in Oracle, sqlserver has an special data type in order by make identity growth. But what about if the number is exceed or approaching the limited ?
Yes. there will show an error like :
Arithmetic overflow error converting IDENTITY to data type int. Arithmetic overflow occurred.
In fact, we could monitor in any time..
Script:
select a.TABLE_NAME,a.COLUMN_NAME,a.DATA_TYPE,
(CASE a.DATA_TYPE when 'int' then 'limited between -2147483648 and 2147483647'
when 'bigint' then 'limited between -9223372036854775808 and 9223372036854775807'
when 'smallint' then 'limited between -32768 and 3767'
when 'decimal' then 'limited between -10^38 and 10^38 - 1'
END
) as "Description",
c.INCREMENT_VALUE,
c.LAST_VALUE as "current identity",
' ',
(CASE a.DATA_TYPE when 'int' then 2147483647
when 'bigint' then 9223372036854775807
when 'smallint' then 3767
when 'decimal' then 9999999999999999999999999999999
END
) as "MAX value"
from INFORMATION_SCHEMA.COLUMNS a inner join
SYS.objects b on a.TABLE_NAME=b.name
inner join SYS.IDENTITY_COLUMNS c on b.object_id=c.object_id
where COLUMNPROPERTY(object_id(a.TABLE_SCHEMA+'.'+a.TABLE_NAME), a.COLUMN_NAME, 'IsIdentity') = 1
and a.COLUMN_NAME=c.name and a.table_name=OBJECT_NAME(c.OBJECT_ID)
order by a.TABLE_NAME
You could see like this following result.

How to check sqlsever table data type identity status ?的更多相关文章
- XML Data Type Methods(一)
XML Data Type Methods(一) /*XML Data Type Methods: 1.The query('XQuery') method retrieves(vt.检索,重新得到) ...
- Extended Data Type Properties [AX 2012]
Extended Data Type Properties [AX 2012] This topic has not yet been rated - Rate this topic Updated: ...
- SQL Server error "Xml data type is not supported in distributed queries" and workaround for it
Recently while working with data migration,got an error while running a following query where Server ...
- [TI DLP Buglist]data type error in illum_EnableIllumination function
I am debuging my code today, I find when my code is running, it's stop at illum_EnableIllumination() ...
- vue bug & data type bug
vue bug & data type bug [Vue warn]: Invalid prop: type check failed for prop "value". ...
- MySql and Oracle Data Type Mappings
the default settings used by SQL Developer to convert data types from MySQL to Oracle. SQL Developer ...
- windows7下解决caffe check failed registry.count(type) == 1(0 vs. 1) unknown layer type问题
在Windows7下调用vs2013生成的Caffe静态库时经常会提示Check failed: registry.count(type) == 1 (0 vs. 1) Unknown layer t ...
- Entity Framework Tutorial Basics(33):Spatial Data type support in Entity Framework 5.0
Spatial Data type support in Entity Framework 5.0 MS SQL Server 2008 introduced two spatial data typ ...
- Inheritance with EF Code First: Part 2 – Table per Type (TPT)
In the previous blog post you saw that there are three different approaches to representing an inher ...
随机推荐
- Burpsuite设置拦截response
一.Burpsuite设置拦截HTTP/HTTPS代理 1, .拦截修改request 首先进入Proxy-Options-Intercept Client Requests设置request拦截的规 ...
- java byte/short/char补充(了解)
1.在数学运算中会自动提升数据类型为 int 2.在基本赋值中,若右册的常量不超过取值范围,javac 添加 强制转换,否则报错 3.若右册 含有 变量 而不是直接使用常量相加,编译报错 例子 pub ...
- python 判断文件的字符编码
import chardet f = open(file='test1.txt', mode='rb') data = f.read() print(chardet.detect(data))
- 我的C++开发工具链
工欲善其事,必先利其器.想要干好活,顺手的工具是必不可少的.来分享下我的C++开发工具链. 平台:Windows 编译器:MSVC IDE:Visual Studio 版本控制:TortoiseGit ...
- CTRL_IKun团队项目总结
1. 团队项目-总结 这个作业属于哪个课程 课程链接 这个作业要求在哪里 作业要求 团队名称 CTRP-lkun 这个作业的目标 团队项目总结,每个人的收获和感悟 Github地址 Github 2. ...
- 英语学习app——Alpha发布1
英语学习app--Alpha发布1 这个作业属这个作业属于哪个课程 https://edu.cnblogs.com/campus/xnsy/GeographicInformationScience/ ...
- Jmeter使用—使用 HTTP代理服务器抓取接口
这里说一下怎么使用jmeter的HTTP代理服务器来抓取接口. 首先,打开jmeter,进入主页面,然后在对工作台(Jmeter版本4.0)点击右键->添加->非测试元件->HTTP ...
- cnblogs 美化主题
Silence主题 一个简洁的主题, 不带广告,我很喜欢 cnblogs 域名解析 这需要注意一点是:github.io项目名需要和用户名一致才能正确访问,否则会报404 Markdown格式化编辑 ...
- 【故障公告】SQL语句执行超时引发网站首页访问故障
非常抱歉,今天早上 6:37~8:15 期间,由于获取网站首页博文列表的 SQL 语句出现突发的查询超时问题,造成访问网站首页时出现 500 错误,由此给您带来麻烦,请您谅解. 故障的情况是这样的. ...
- 浅谈openresty
浅谈openresty 为什么会有OpenResty? 我们都知道Nginx有很多的特性和好处,但是在Nginx上开发成了一个难题,Nginx模块需要用C开发,而且必须符合一系列复杂的规则,最重要的用 ...