SQL - Check if a column auto increments

后端 未结 4 1715
轻奢々
轻奢々 2020-12-14 02:29

I am trying to run a query to check if a column auto increments. I can check type, default value, if it\'s nullable or not, etc. but I can\'t figure out how to test if it au

4条回答
  •  失恋的感觉
    2020-12-14 03:05

    this works for sql server:

        Select COLUMN_NAME, TABLE_NAME
        from INFORMATION_SCHEMA.COLUMNS
        where TABLE_SCHEMA = 'dbo'
        and COLUMNPROPERTY(object_id(TABLE_NAME), COLUMN_NAME, 'IsIdentity') = 1
        order by TABLE_NAME
    

提交回复
热议问题