sqlserver 取表结构 ,显示自增长字段

sqlserver 取表结构 ,显示自增长字段IS_IDENTITY =1 是自增长

select * from (Select 
D.Name table_en,
space(200)table_note,  
A.Name column_en,    
--convert(char(30),Isnull(G.[Value],a.name)) As column_ch,   
B.Name column_type,    
COLUMNPROPERTY(a.id, a.name, 'IsIdentity') IS_IDENTITY	,	
Columnproperty(A.Id,A.Name,'Precision') column_long,    
Isnull(Columnproperty(A.Id,A.Name,'Scale'),0) As column_dec,        
(Case When (Select Count(*) From Sysobjects      
Where (Name In  (Select Name   From Sysindexes   Where (Id = A.Id) 
And (Indid In   (Select Indid   From Sysindexkeys   Where (Id = A.Id) 
And (Colid In   (Select Colid  From Syscolumns   Where (Id = A.Id) 
And (Name = A.Name))))))) And    (Xtype = 'Pk'))>0 Then 'Y' Else 'N' End) column_key,  
(Case When A.Isnullable=1 Then 'Y'Else 'N' End) as column_null,   
Isnull(E.Text,'') column_default,
0 zt_column,

你可能感兴趣的:(pb,数据库,sql)