Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Query for Identity columns

Author  Topic 

scelamko
Constraint Violating Yak Guru

309 Posts

Posted - 2005-10-06 : 18:53:42
Guys,
I am trying to query the database to find all columns which have identity property
I have tried querying the syscolumns and also tried to use information schema views, but I cudn't get far

Please let me if you have any other way to find it out

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2005-10-06 : 19:26:43
SELECT table_name, column_name as Identity_Column
FROM information_schema.columns
WHERE COLUMNPROPERTY(OBJECT_ID(table_name),column_name,'IsIdentity')=1
order by table_name

Tara
Go to Top of Page
   

- Advertisement -