You can allow insert to the identity field by setting IDENTITY_INSERT ON for a particular table
1.SET IDENTITY_INSERT <tablename> ON
INSERT INTO <tablename>(UserId,UserName,Qualification) VALUES(1,'Test','B.Tech')
INSERT INTO <tablename>(UserId,UserName,Qualification) VALUES(2,'Test123','MSC')
SET IDENTITY_INSERT <tablename> OFF
After Inserting your own value to identity field don't forget to set IDENTITY_INSERT OFF.
You can also reseed the identity field value. By doing so identity field values will start with a new defined value.
2. DBCC checkident (<tablename>, RESEED, no.)
No comments:
Post a Comment