Wednesday, January 30, 2013

Identity Column


By using this simple query you can find particular table has identity column on it or not and other valuable information.

SELECT   OBJECT_NAME(OBJECT_ID) AS TableName,
             Name AS ColumnName, -- Which column that identity property set on
             Seed_value, -- Current Seed Value
             Increment_Value,  -- Current Increment value
             Last_Value, -- Last value that entered in that column
             IS_NOT_FOR_REPLICATION -- whether it is replicated(1) or Not(0)
    FROM     SYS.IDENTITY_COLUMNS
    WHERE OBJECT_NAME(OBJECT_ID) = 'Srvs_DailyCheck' -- Please enter your table name

No comments:

Post a Comment