Search code examples
sql-servert-sqlmetadata

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


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


Solution

  • You can also do it this way:

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

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