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

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

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

5条回答
  •  梦谈多话
    2021-02-05 02:29

    Identity is the value that is used for the very first row loaded into the table.

    There is a microsoft article which can provide good knowledge about Identity:

    https://docs.microsoft.com/en-us/sql/t-sql/statements/create-table-transact-sql-identity-property?view=sql-server-2017

    Now, there are couple of ways for identifying which column is an identity column in a table:

    • We can use sql query: select columnproperty(object_id('mytable'),'mycolumn','IsIdentity')
    • sp_help tablename

提交回复
热议问题