Hi! Ihave table person:
ID FirstName Name
1 Asrori Yatim
2 Safarov Sarabek
3 Malaev Nurullo
But I want create auto_increment in the procedure sql or in asp.net for automaticaly insert id.
Before insert id first of all check sort id and insert id. If id not by sort such:
Id
1
3
4
6
Then sort it’s id such:
2
5
Then insert 7,8 and ect.
Hi Firuz,
You need to do like below.
SET NOCOUNT ON SELECT @ID = ISNULL(MAX(ID), 0) + 1 FROM person
© COPYRIGHT 2025 ASPSnippets.com ALL RIGHTS RESERVED.