CK (c_kettenbach (AT) hotmail (DOT) com) writes:
Quote:
Is there a way to check if INDENTITY is enabled on a table?
I want to provide a table name and see if Identity (Autonumber) is enabled
on it. Is this possible? |
There are several ways. The quickest is probably
SELECT CASE WHEN ident_current('tbl') IS NOT NULL
THEN 'Has identity'
ELSE 'Nope'
END
You can also use objectproperty, or look in sys.columns (SQL 2005 only).
--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx