example:-
| id | name | product | brand |
| 1 | swapnil | britaniya | good |
| 2 | bhavesh | mary | average |
In this table id is identity column is u try to insert value on open table on id column it will not happen because column is readonly format when u insert new row it will automatically insert id 3
so if u want to insert third record id is 20 for that u have to do below code
SET IDENTITY_INSERT test ON
Insert Into test (Id,name,product,brand) VALUES (20,'wer','Product1','Brand1')
SET IDENTITY_INSERT test OFF
by using this code u can insert next id row to 20 successfully
----------------------------------------------------------------------------------------------
how to create identity column
select table right click design
column properties window display
select identityspecification =yes
isidentity =yes
identity increment =1
identity seed =1
No comments:
Post a Comment