SELECT IDENTITYCOL FROM yourTable : IDENTITYCOL « Sequence Indentity « SQL Server / T-SQL Tutorial






2> CREATE TABLE customer
3> (
4> cust_id      smallint        IDENTITY(100, 20)  NOT NULL,
5> cust_name    varchar(50)     NOT NULL
6> )
7> GO
1>
2> INSERT customer VALUES ('ACME Widgets')
3> INSERT customer (cust_name) VALUES ('AAA Gadgets')
4> GO

(1 rows affected)

(1 rows affected)
1>
2>
3> SELECT IDENTITYCOL FROM customer
4> SELECT cust_id FROM customer
5> GO
cust_id
-------
    100
    120

(2 rows affected)
cust_id
-------
    100
    120

(2 rows affected)
1>
2> drop table customer;
3> GO








15.2.IDENTITYCOL
15.2.1.Using the IDENTITYCOL Keyword
15.2.2.SELECT IDENTITYCOL FROM yourTable