How do I determine if a column is an identity column in MSSQL 2000?

Bialecki picture Bialecki · Oct 9, 2008 · Viewed 27.3k times · Source

I want to do this in code, not with ALT+F1.

Answer

Blorgbeard is out picture Blorgbeard is out · Oct 9, 2008

You can also do it this way:

select columnproperty(object_id('mytable'),'mycolumn','IsIdentity')

Returns 1 if it's an identity, 0 if not.