473,788 Members | 2,814 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reattaching database - identity_insert set to off

ll
Hi,
I recently detached and subsequently reattached a database, and now
I've had to go back to each table and re-establish the primary keys,
as well as the identity="yes" where needed. I am currently getting
the following error message, although this table's identity_insert is
set to ON ("yes").
I'm currently re-checking all other tables to see if they would
perhaps impact this.
Would there be anything else I could do at this point? (error msg
below:)
-------------------------
Microsoft OLE DB Provider for SQL Server error '80040e14'
Cannot insert explicit value for identity column in table
'AMS_Courses' when IDENTITY_INSERT is set to OFF.
-------------------------

Thanks for your help in this,
Louis

Jun 27 '08 #1
5 3544
"ll" <ba**********@y ahoo.comwrote in message
news:83******** *************** ***********@8g2 000hse.googlegr oups.com...
Hi,
I recently detached and subsequently reattached a database, and now
I've had to go back to each table and re-establish the primary keys,
as well as the identity="yes" where needed.
Sounds a little strage. There should be no need to "re-establish" primary
keys when a database has been detached and attached. Are you saying the
constraints disappeared?

--
David Portas
Jun 27 '08 #2
>I recently detached and subsequently reattached a database, and now I've had to go back to each table and re-establish the PRIMARY KEYs, as well as the IDENTITY="YES" where needed. <<

That makes no sense. The PRIMARY KEY of a table is a subset of the
attributes that uniquely identify the entities. Do you mean that you
are validating the keys against a trusted external/internal source or
what? Surely, you did not use IDENTITY as a key! There a posting on
another SQL Server site at ITToolbox.com on a problem like this.
>Would there be anything else I could do at this point? <<
First, update your resume and then read a book on basic RDBMS design,
in case you are ever hired again.
Jun 27 '08 #3
On Thu, 15 May 2008 23:07:16 +0100, "David Portas"
<RE************ *************** *@acm.orgwrote:

This is not uncommon in bad SQL Server database designs where a junior
designer forgot the primary keys. Of course he/she should meet with
some tar and feathers very soon.
Then when one wants to attach such tables to MsAcces, it recognizes no
PK, and asks the user which fields should be considered PK, so it can
keep the table updatable.

If the above scenario is true, the obvious solution is to first fix
the SQL Serve database design.

-Tom.

>"ll" <ba**********@y ahoo.comwrote in message
news:83******* *************** ************@8g 2000hse.googleg roups.com...
>Hi,
I recently detached and subsequently reattached a database, and now
I've had to go back to each table and re-establish the primary keys,
as well as the identity="yes" where needed.

Sounds a little strage. There should be no need to "re-establish" primary
keys when a database has been detached and attached. Are you saying the
constraints disappeared?
Jun 27 '08 #4
Hi Louis,

Detaching a database simple checkpoints it and removes the database from the
system catalogue - it does not touch or change any of your schema,
properties or even database properties.

Attaching a database simply puts the entry for the database back into
master..sysdata bases and recovers the database - it does not touch or change
any of your schema, properties or even database properties.

The only to get the situation you have is for somebody to do it manually.

Tony.

--
Tony Rogerson, SQL Server MVP
http://sqlblogcasts.com/blogs/tonyrogerson
[Ramblings from the field from a SQL consultant]
http://sqlserverfaq.com
[UK SQL User Community]
"ll" <ba**********@y ahoo.comwrote in message
news:83******** *************** ***********@8g2 000hse.googlegr oups.com...
Hi,
I recently detached and subsequently reattached a database, and now
I've had to go back to each table and re-establish the primary keys,
as well as the identity="yes" where needed. I am currently getting
the following error message, although this table's identity_insert is
set to ON ("yes").
I'm currently re-checking all other tables to see if they would
perhaps impact this.
Would there be anything else I could do at this point? (error msg
below:)
-------------------------
Microsoft OLE DB Provider for SQL Server error '80040e14'
Cannot insert explicit value for identity column in table
'AMS_Courses' when IDENTITY_INSERT is set to OFF.
-------------------------

Thanks for your help in this,
Louis
Jun 27 '08 #5
what? Surely, you did not use IDENTITY as a key! There a posting on
another SQL Server site at ITToolbox.com on a problem like this.
Stop spreading myth's and disinformation - they are not helpful to the OP.

You should be ashamed of yourself celko; that said - it's you all over; the
"follow my ideas or be dammed" attitude - very arrogant.

I'd like to see the URL to the article you talk about so I can educate you
further on using MICROSOFT SQL SERVER.

--
Tony Rogerson, SQL Server MVP
http://sqlblogcasts.com/blogs/tonyrogerson
[Ramblings from the field from a SQL consultant]
http://sqlserverfaq.com
[UK SQL User Community]

Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
3060
by: lkrubner | last post by:
I have a webserver through Rackspace. I create a domain. I create an FTP user. I upload some files. I create a database called testOfSetupScript and then I create a database user named setup. I write some PHP code which should, I think, be able to to auto create the tables. The SQL looks like this:
0
3926
by: Cherrish Vaidiyan | last post by:
hello, Thanx for the suggestions on my Listener query. Now i am performing a simple work.. STANDBY DATABASE creation. I have followed the instraction from Oracle 9i Release 1 documentation but have some doubts. here are the basic stpes i followed. 1 Either make a new backup of the primary database datafiles or access
0
3341
by: Cherrish Vaidiyan | last post by:
sir, The following are the steps that i followed in setting up standby database on Red hat Linux 9. i am using Oracle 9i. i have followed the steps in this site : http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96653/create_ps.htm#66206 Still i give the steps i followed. Preparing the Primary Database for Standby Database Creation
1
6104
by: drs | last post by:
Hi, I am having a problem with IDENTITY_INSERT command with MSDE 2000 (ADO 2.8) in that I cannot insert a specific value to an identity field. (lines below with >>> are code lines. I am using Python, but the syntax should be about the same as VBScript) First, I create an ADO Connection and create my table.
4
19372
by: Mikael Syska | last post by:
Hi, How can I set IDENTITY_INSERT to ON on the mssql server via C#, and turn it OFF again, after I have made my insert? Cause right now I can't sinde one of the Column's have IDENTITY on. Kind Regards Mikael Syska
1
1844
by: Saintor | last post by:
Can somebody provide the minimal code (DAO) to link one Access table from an external file (A2K)? I have seen the examples in MVPS/MS and the code seems to want to to everything. just can't get the essential. Is there any difference between A97 and A2K? TIA
10
8221
by: teddysnips | last post by:
SQL Server 2000 (DDL below) If I try to run this code in QA: SET IDENTITY_INSERT tblAdminUsers ON INSERT INTO tblAdminUsers (fldUserID, fldUsername, fldPassword, fldFullname,
17
1476
by: IC1(SW/AW) | last post by:
I am trying to create a unique type of registration form for my job upcoming Holiday Christmas Party. There will be 60 tables for seatings with 10 people max at table. How can I write some codes to support this? I need to be able to see the number of people who are seating and any available seats at a given table. How can I set my database and pull the information to give what I want.
8
4081
by: Lee | last post by:
guys, I have a project need to move more than 100,000 records from one database table to another database table every week. Currently, users input date range from web UI, my store procedure will take those date ranges to INSERT records to a table in another database, then delete the records, but it will take really long time to finish this action (up to 1 or 2 hours). My question is if there is some other way I should do to speed up...
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10366
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4070
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.