CREATE TABLE [student](
[studentID] [int] identity(1,1),
[studentname] [varchar](50) NULL
) ON [PRIMARY]
select * from student
delete from student where
[studentname]='sonia'
INSERT [student] ( [studentname]) VALUES ( N'Faizal')
INSERT [student] ( [studentname]) VALUES ( N'Maria')
INSERT [student] ( [studentname]) VALUES ( N'sophia')
--Then insert
INSERT [student] ( [studentname]) VALUES ( N'sonia')
--Then delete
delete from student where
[studentname]='sonia'
--Then insert
INSERT [student] ( [studentname]) VALUES ( N'sonia')
--Notice that
Identity has jumped to some numbers
--To reset that
use the command as follows
---If we want
the Next ID to be 5 , type 4
DBCC CHECKIDENT (student, reseed, 4)
No comments:
Post a Comment