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

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

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

5条回答
  •  天涯浪人
    2021-02-05 02:33

    As expansion on @Blogbeard's answer

    If you like pure query and not inbuilt functions

    select col_name(sys.all_objects.object_id, column_id) as id from sys.identity_columns 
    join sys.all_objects on sys.identity_columns.object_id = sys.all_objects.object_id
    where sys.all_objects.name = 'system_files'
    

提交回复
热议问题