Labels

Friday, August 31, 2007

Working with IDENTITY COLUMN

Below is required to work with IDENTITY column in SQL-Server

set identity_insert Table_1 OFF

INSERT INTO Table_1 VALUES('AA')

SELECT * FROM Table_1

set identity_insert Table_1 ON

INSERT INTO Table_1 (ID,NAME) VALUES(1,'AA')

SELECT * FROM Table_1

DELETE FROM Table_1

DBCC CHECKIDENT (Table_1, RESEED, 0) -- To reset the value

Thanks & Regards,

Arun Manglick || Tech Lead

No comments:

Post a Comment