how to set identity by query in table .
while creating by query in sql server 2008-2005 if you want to add
primary key with identity then you need to add primary key with identity at same time.
or if you have already added then alter that column but need to take care of it.
here i have shown how to add identity with primary key in sql server 2005 and sql server 2008.
db name is stud
and table name is student.
user stud
create table student
(
id int NOT NULL primary key identity ,
roll int not null,
name varchar(30) not null
)
while creating by query in sql server 2008-2005 if you want to add
primary key with identity then you need to add primary key with identity at same time.
or if you have already added then alter that column but need to take care of it.
here i have shown how to add identity with primary key in sql server 2005 and sql server 2008.
db name is stud
and table name is student.
user stud
create table student
(
id int NOT NULL primary key identity ,
roll int not null,
name varchar(30) not null
)
0 comments: