How do you determine what SQL Tables have an identity column programmatically

后端 未结 13 2094
借酒劲吻你
借酒劲吻你 2020-11-30 23:44

I want to create a list of columns in SQL Server 2005 that have identity columns and their corresponding table in T-SQL.

Results would be something like:

Tab

13条回答
  •  孤街浪徒
    2020-12-01 00:25

    In SQL 2005:

    select object_name(object_id), name
    from sys.columns
    where is_identity = 1
    

提交回复
热议问题