Find identity columns on sqlserver
The IDENTITY areĀ Auto Increment columns as some developers call them, are auto incrementing columns provided by SQL Server. There can only be one IDENTITY column per table. You just have to provide a base value, and an increment value, and SQL Server will take care of incrementing this column automatically.
Some times you may have to find if certain table contains identity column or not.
You can use script to list the ColumnName which is Identity column of a given database.
Code:
select * from sys.columns as c where c.is_identity=1 and object_id=(select object_id from sys.tables where name='TableName')






