Q
Problem solve Get help with specific problems with your technologies, process and projects.

Insert values into IDENTITY column

I pulled some data in using the import utility in SQL Server and placed it into results. I added a couple columns with default values to match the table to merge with the data. The receiving table has an identity column and I have tried different approaches to get the data into the receiving table without success. I finally dropped the first column, loaded the data, recreated the identity column and re-established relationships. What am I missing?

I pulled some data in using the import utility and place the data into results. I add a couple columns with default values to match the table I want to merge the data to. The receiving table has an identity column and I have tried different approaches to get data into the receiving table, but with failure. I finally just drop that first column, load the data and then recreate the identity column and re-establish relationships. What am I missing? I looking forward to learn a new trick.
If you need to insert values into an IDENTITY column, you first need to SET IDENTITY_INSERT ON. Then SQL Server will allow you to insert that column as well.
This was last published in October 2006

Dig Deeper on Microsoft SQL Server Performance Monitoring and Tuning

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Please create a username to comment.

-ADS BY GOOGLE

SearchBusinessAnalytics

SearchDataCenter

SearchDataManagement

SearchAWS

SearchOracle

SearchContentManagement

SearchWindowsServer

Close