Explaint reset of identity column in SQL.

In this article we will show you the steps to  reset identity column in MS SQL Server database.

Create a table Employee

CREATE TABLE [dbo].[Employee](
[ID] [int] IDENTITY(1,1) NOT NULL,
[EmployeeName] [varchar](50) NULL,
[City] [varchar](50) NULL,
[Mobile] [varchar](50) NULL,
 CONSTRAINT [PK_Employee] PRIMARY KEY CLUSTERED 
(
[ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

Inert Data into Employee table
854-675-EMP.png
Figure 1. 854-675-EMP.png

Then delete a record from employee table where ID=3 and result is:
854-738-Deleted
Figure 2. 854-738-Deleted Record.png
DELETE FROM Employee WHERE ID= 3; 

Then delete a record from employee table where ID=3 and result is:
DELETE FROM Employee WHERE ID= 3; 

Show deleted record using select query
854-74-Deleted
Figure 3. 854-74-Deleted Record.png

Insert data into Employee table using normal insert sql query
854-28-INSERT
Figure 4. 854-28-INSERT DATA.png

See inserted record 
854-98-Inserted
Figure 5. 854-98-Inserted Record.png

Again, insert data into Employee table where ID=3 then:
854-673-Again
Figure 6. 854-673-Again Inserted Record.png

See inserted record now
854-590-Inserted
Figure 7. 854-590-Inserted Record 2.png
Need Help? Contact Us.

Log in

*
*

Forgot password?

*

New User

*
*
*
*