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 ...
随机推荐
- Matlab学习过程中的一些小问题
1.Overload your functions by having variable number of input and output argumernt.Not only can we ov ...
- surging 社区版本支持.net core 3.1
简介 surging 经过两年多的研发,微服务引擎已经略有雏形,也承蒙各位的厚爱, GitHub上收获了将近2800星,fork 811,付费用户企业也有十几家,还有咨询培训, 在2020年,我们将依 ...
- centos7 安装jdk8和maven3
centos7 安装jdk8和maven3 标签(空格分隔): java,linux jdk 第一种安装: yum install java-1.8.0-openjdk /usr/lib/jvm/ 默 ...
- Android Gradle脚本从Groovy迁移到Kotlin DSL
Android Gradle从Groovy迁移到Kotlin Android项目用Gradle构建, 其脚本语言之前是Groovy, 目前也提供了Kotlin的支持, 所以可以迁移到Kotlin. 官 ...
- 两个关于 Java 面试的 Github 项目
哈喽,大家好.相信大家都知道金九银十,在人才市场上是指每年的 9 月和 10 月是企业的招聘高峰期.这个时候企业往往有大量招聘需求,求职者在这个时候就找工作无疑是最适合的.需求大,谈工资什么的就更容易 ...
- python的requests用法详解
Requests是一个Python语言写的http相关设置或者请求的一个库 安装:pip install Requests或者pip3 install requests 使用的时候要import re ...
- 投影方式- Unity3D游戏开发培训
投影方式- Unity3D游戏开发培训 作者:Jesai 2018-02-12 20:33:13 摘 要 透视投影是3D渲染的基本概念,也是3D程序设计的基础.掌握透视投影的原理对于深入理解其他 ...
- Java.Json模板.省市区三级JSON
[ { "name": "北京市", "city": [ { "name": "北京市", &quo ...
- 资源| 学习视频库-永久有效,持续更新!附赠java面试汇总
每天进步一丢丢,连接梦与想 我们总是羡慕他人的光芒,却忘记自己也会发光 声明 资源来自于网络,小编只是资源的搬运工,若有侵权,联系小编即删. 期待已久的学习视频库来啦! 经过小编多日整理,整理了1.5 ...
- octave在win上和linux上配置syms
octave是类似matlab的一个科学计算工具集.需要用到积分.微分.求导的时候,需要连接python3的sympy. windows上先安装好python3,然后pip安装Sympy.具体过程: ...