Search
Winners

Win Prizes

Social Presence
Like us on Facebook
Advertisements
Ads

Insert values into Primary Key or Auto-Generated Column

vishalneeraj-24503
Posted by vishalneeraj-24503 under Sql Server on 11/12/2013 8:49:37 AM | Points: 75 | Views : 2063 | Status : [Member] [MVP]

If we try to insert values into an Auto-generated column, then it will not allow us to insert data into Primary Key column but if there is a requirement that we must insert values in an Auto-generated column,to do this

With the help of Identity_Insert keyword, we can insert any numeric values to Auto-generated column


Set Identity_Insert Table_Name ON

//Write your insert query

Set Identity_Insert Table_Name OFF



Comments or Responses


Login to post response