Search This Blog

how to know, if a table has an identity column.

1.

SELECT IDENT_CURRENT('urtable')
Will be null for non identity table
2.

select OBJECT_NAME(ID) Tablename, name from syscolumns where colstat & 1 = 1

3.

SELECT COLUMNPROPERTY(OBJECT_ID('tableName'),'ColumnName','IsIDENTITY')

No comments: