转,【小小问题集锦12之---查找具有IDENTITY列的表和其列】
转自,https://blog.csdn.net/feixianxxx/article/details/5299902
/*----------------------
*问题描述:如何知道数据库中存在IDENTITY属性的表以及确定该表中的IDENTITY属性列名?*/
use dbname
go
Select table_name as 表名,column_name as 列名
from information_schema.columns
where columnproperty(object_id(table_name),column_name,'IsIdentity')=1