---
title: "How to insert values to identity column in SQL Server."  
description: "How to insert values to identity column in SQL Server."  
author: "Anonymous User"  
published: 2016-03-03  
updated: 2016-03-03  
canonical: https://www.mindstick.com/forum/34026/how-to-insert-values-to-identity-column-in-sql-server  
category: "mssql server"  
tags: ["sql server"]  
reading_time: 1 minute  

---

# How to insert values to identity column in SQL Server.

We want to [insert](https://www.mindstick.com/blog/173/executing-insert-delete-or-update-query-in-sqlserver-using-ado-dot-net) [values](https://www.mindstick.com/forum/327/sum-textbox-values) to [identity column](https://www.mindstick.com/forum/103/how-to-insert-data-in-identity-column) in [SQL Server](https://www.mindstick.com/articles/12999/what-is-table-valued-function-in-sql-server). How to do this Please Help me.

## Replies

### Reply by Anonymous User

```
You can alllow insert to the identity field by setting IDENTITY_INSERT ON for a specific table.    Show below:SET IDENTITY_INSERT [Employee] ON You can also disalllow insert to the identity field by setting IDENTITY_INSERT OFF for a specific  table. shown below:SET IDENTITY_INSERT [Employee] OFF  For Example: CREATE TABLE [dbo].[Employee] (
    [EmpNo]       INT  IDENTITY (1, 1) NOT NULL,
    [EmpName]     VARCHAR (50) NOT NULL,
    [Salary]      DECIMAL (18) NOT NULL,
    [DeptName]    VARCHAR (50) NOT NULL,
    [Designation] VARCHAR (50) NOT NULL,
    PRIMARY KEY CLUSTERED ([EmpNo] ASC)    ); SET IDENTITY_INSERT [Employee] ON
  
 INSERT INTO [Employee]([EmpNo],[EmpName],[Salary],[DeptName],[Designation]) VALUES(1,'Aditya',20000,'Development','Programmer')
INSERT INTO [Employee]([EmpNo],[EmpName],[Salary],[DeptName],[Designation]) VALUES(2,'Anupam',30000,'Development','Programmer')
  
 SET IDENTITY_INSERT [Employee] OFF

INSERT INTO [Employee]([EmpName],[Salary],[DeptName],[Designation]) VALUES('Pawan',40000,'Development','Programmer') select * from Employee 
```

![How to insert values to identity column in SQL Server.](https://www.mindstick.com/mindstickforums/797f0029-a34c-438a-87df-050b8e3ea86e/images/8fa0a915-f483-4188-a120-dfa1ff141294.png)


---

Original Source: https://www.mindstick.com/forum/34026/how-to-insert-values-to-identity-column-in-sql-server

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
