The IDENTITYCOL variable can be used instead of the name of the column with the IDENTITY property.
8> CREATE TABLE product
9> (product_no INTEGER IDENTITY(10000,1) NOT NULL,
10> product_name CHAR(30) NOT NULL,
11> price MONEY)
12> GO
1>
2> SELECT IDENTITYCOL
3> FROM product
4> WHERE product_name = 'Soap'
5> GO
product_no
-----------
(0 rows affected)
1> drop table product;
2> GO
|