TSQL Script to Find All Identity Columns in a Database
select syscolumns.Name [Identity Column], sysobjects.Name [Table]
from syscolumns
inner join sysobjects on sysColumns.id = sysObjects.id
where autoval is not null
[Oh geeky joy!]
random ramblings of a bearded man
select syscolumns.Name [Identity Column], sysobjects.Name [Table]
from syscolumns
inner join sysobjects on sysColumns.id = sysObjects.id
where autoval is not null
[Oh geeky joy!]
at 13:17
1 comment:
Here a version for SQL server 2005:
select distinct
so.Name [Table],
sc.Name [Identity Column]
from
sys.columns sc
inner join sys.objects so on sc.object_id = so.object_id
where
is_Identity = 1
order by
1
#Jean.
Post a Comment