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

后端 未结 5 1138
感情败类
感情败类 2021-02-05 01:47

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

5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-05 02:38

    You can also do it this way:

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

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

提交回复
热议问题