How to insert record
into identity column in Sql Server
Step:1- Create a table
create table student(id int identity(1,1) not null primary key,name varbinary(50))
Insert Data in student table in Sql :-
insert into student(name) values('Ramu Gupta')
create table student(id int identity(1,1) not null primary key,name varbinary(50))
Insert Data in student table in Sql :-
insert into student(name) values('Ramu Gupta')
When you
enter record this way:-
insert into student(id,name)
values(1,'Ramu Gupta')
The above written
sql program will generate error. But we
can insert data in identity column by this way….
Set identity_insert on
insert into student(id,name) values(1,'Ramu Gupta')
insert into student(id,name) values(2,'Sachi Gupta')
Set identity_insert off
1 comments:
Cool blog you got here and thank you for the valuable information. This is truly a great read for me and definitely be back to read some more.
www.n8fan.net
Post a Comment