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 ...
随机推荐
- java小项目之:植物大战僵尸,这个僵尸有点冷!内附素材源码
Java小项目之:植物大战僵尸! <植物大战僵尸>是由PopCap Games开发的一款益智策略类单机游戏,于2009年5月5日发售,这款游戏可谓是无人不知无人不晓. 在我身边,上到40岁 ...
- C#多线程与异步
1.什么是异步同步 如果一个方法被调用,调用者需要等待该方法被执行完毕之后才能继续执行,则是同步. 如果方法被调用后立刻返回,即使该方法是一个耗时操作,也能立刻返回到调用者,调用者不需要等待该方法,则 ...
- python基础操作以及变量运用
今天学习关于pycharm的操作以及变量的知识 1.关于pycharm的基本操作,作为一个小白,仪式感还是要有 在基础界面上新建然后打印hello world,也是对python的一种尊重吧 2.关于 ...
- Greedy Gift Givers 贪婪的送礼者 USACO 模拟
1002: 1.1.2 Greedy Gift Givers 贪婪的送礼者 时间限制: 1 Sec 内存限制: 128 MB提交: 9 解决: 9[提交] [状态] [讨论版] [命题人:外部导入 ...
- Python中函数参数 *args 和 **kwargs
普通参数,即在调用函数时必须按照准确的顺序来进行参数传递. 默认参数,即参数含有默认值,在调用函数时可以进行参数传递,若没有进行参数传递则使用默认值,要注意,默认参数必须在普通参数的右侧(否则解释器无 ...
- poj 2689 区间素数筛
The branch of mathematics called number theory is about properties of numbers. One of the areas that ...
- SpringSecurity 初始化流程源码
SpringSecurity 初始化流程源码 本篇主要讲解 SpringSecurity初始化流程的源码部分,包括核心的 springSecurityFilterChain 是如何创建的,以及在介绍哪 ...
- 临近年关,修复ASPNETCore因浏览器内核版本引发的单点登陆故障
临近年关,咨询师提出360,搜狗急速浏览器无法单点登陆到公司核心产品WD, 报重定向过多. 现象 经过测试, 出现单点登陆故障的是搜狗,360等主打双核(默认Chrome内核)的浏览器, 较新式的Ed ...
- vue拦截器
1.在路由添加 meta:{ requireAuth:true } 完整 { path: '/xx', name: 'xx', component: xx, meta:{ requireAuth:tr ...
- 关于Error executing aapt的问题
这两天装了ubuntu 14.0.4系统,在这个系统上装了eclipse的android开发环境.原以为一切顺利,结果开发环境装完导入工程后,工程提示有红叉. R文件不能自动生成,按R文件不能自动生成 ...