Query to get the name of the identity column for a given table

Query to get the name of the identity column for a given table.
To Get the Identity column name for Tbl_Customer we need to execute the following query.
SELECT D.name AS ColumnName, O.name AS TableName
FROM sys.identity_columns D INNER JOIN Sys.Objects O ON O.object_id=D.object_id
Where O.name='Tbl_Customer

0 comments: