Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7699009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T22:22:42+00:00 2026-05-31T22:22:42+00:00

I am writing a web based importer to import data from one database to

  • 0

I am writing a web based importer to import data from one database to another database. Since the data gets loaded into a table that has an identity, I need to enable Identity_Inserts prior to executing my insert statement. I generate the SQL statements I would need to run into a List, and what I would like to do is set IDENTITY_INSERT to ON prior to looping through the commands, then set it to back off once complete. I am going to execute each command one at a time because I want to keep track of which commands failed.

I tried executing SET IDENTITY_INSERT [TABLE NAME] ON before starting the loop, but this isn’t working.

How can I accomplish what I am trying to do, or does anyone have any other ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T22:22:43+00:00Added an answer on May 31, 2026 at 10:22 pm

    Taken from https://connect.microsoft.com/SQLServer/feedback/details/517923/set-identity-insert-already-on-error-message-always-returns-dbo-schema-name

    SQL 2k8 BOL states “At any time, only one table in a session can have the IDENTITY_INSERT property set to ON. If a table already has this property set to ON, and a SET IDENTITY_INSERT ON statement is issued for another table, SQL Server returns an error message that states SET IDENTITY_INSERT is already ON and reports the table it is set ON for.”

    So I guess, you’ll need to set it OFF at the end of the loop?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a web based front end to a database (PHP/Postgresql) in which I
I am looking into writing a web-based vehicle tracking system. The framework I have
I am looking into writing web based games using just Javascript, HTML, and CSS.
I am writing a web based application using Ruby on Rails. In one of
I'm writing web application where I need to push data from server to the
I'm writing a PHP-based web application that should work with multiple database systems. The
I'm writing a web-based app from scratch, that needs PDF generation capabilities. All other
I'm writing an ASP.NET C# web site that needs to access data from a
I'm writing a web based application that will have its own authorization/authentication mechanism (traditional
I'm writing a simple web-based site for a company to display products on their

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.