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 to find identity fields

Author  Topic 

beyonder422
Posting Yak Master

124 Posts

Posted - 2006-03-23 : 17:12:43
where can I query to find all fields that are set to be "Identity" fields?

is it possible?

www.beyonder422.com

rockmoose
SQL Natt Alfen

3279 Posts

Posted - 2006-03-23 : 17:50:38
[code]select object_name(id), name from syscolumns where columnproperty(id,name,'IsIdentity') = 1

select object_name(id), name from syscolumns where status & 0x80 = 0x80[/code]

___________________________________________________________________________________________
When you press Alt-X to submit the post, you know you spent too much time in query analyzer

rockmoose
Go to Top of Page

beyonder422
Posting Yak Master

124 Posts

Posted - 2006-03-23 : 17:59:17
thanx...

www.beyonder422.com
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-03-24 : 05:09:49
And other method

SELECT table_name, column_name
FROM information_schema.columns WHERE COLUMNPROPERTY(OBJECT_ID( table_name),
column_name,'IsIdentity')=1


Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -