Solved

IDENTITY_INSERT is set to OFF.

Posted on 2007-12-01
14
4,550 Views
Last Modified: 2013-12-16
Hallo experts.
I want your help to fix my problem.
When i try to insert in a db table (t_artikel) i have the following error:
 Error Executing Database Query.
[Macromedia][SQLServer JDBC Driver][SQLServer]Cannot insert explicit value for identity column in table 't_artikel' when IDENTITY_INSERT is set to OFF.
I use cf8 and ms sql server.
please help.
0
Comment
Question by:Panos
  • 6
  • 4
  • 2
  • +1
14 Comments
 
LVL 52

Expert Comment

by:_agx_
ID: 20387630
That means you're trying to insert a value into an identity column.  Normally you don't do this.   Identity columns generate the numbers automatically.  ie so you don't have to insert a value.  
0
 
LVL 52

Accepted Solution

by:
_agx_ earned 125 total points
ID: 20387637
> When i try to insert in a db table (t_artikel)

Check your insert statement.  If you've accidentally included the identity column in the insert list like this

<cfquery ...>
INSERT INTO YourTable (TheNameOfYourIdentityColumn, Name, OtherColumns...)
VALUES (1, 'Some Name', 'Other Values....', ...)
</cfquery>

Remove it from the insert and values list

<cfquery ...>
INSERT INTO YourTable (Name, OtherColumns...)
VALUES ( 'Some Name', 'Other Values....', ...)
</cfquery ...>
0
 
LVL 25

Assisted Solution

by:imitchie
imitchie earned 125 total points
ID: 20387639
the short answer is that instead of
INSERT INTO t_artikel (ID, a,b,c,d...) values (1,2,3,4,5...)
just drop the ID column, so it becomes
INSERT INTO t_artikel (a,b,c,d...) values (2,3,4,5...)
0
 
LVL 52

Expert Comment

by:_agx_
ID: 20387642
Was that not just what I said? :)
0
 
LVL 25

Expert Comment

by:imitchie
ID: 20387674
I find examples a lot clearer, same for SQL, C#, C++, PHP or just anything really.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 20387675
Umm.. yes, that's why I included one ;-)
0
Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

 
LVL 25

Expert Comment

by:imitchie
ID: 20387680
ahh.. sorry. i saw your original one, then i saw the essay from the other comment. i hadn't seen the other one before i piped in.
0
 
LVL 52

Expert Comment

by:_agx_
ID: 20387683
> then i saw the essay from the other comment
(rofl)

No problem :)
0
 
LVL 15

Expert Comment

by:spprivate
ID: 20387717
The idea behind giving extra information is that you understand the concept in full rather than solving the problem one time.So lets concentrate on giving solutions rather than commenting other's answers.
0
 
LVL 25

Expert Comment

by:imitchie
ID: 20387720
the corollary to that argument is that if everyone wanted information rather than a solution, we don't need to be here! BOL+Google covered that ground already
0
 
LVL 52

Expert Comment

by:_agx_
ID: 20387722
spprivate,

Posting a few sample lines is okay.  But if its a long section in the documentation, better to post a link or point the asker to the pertinent section in the Books On Line.  Too much information can be overwhelming and is often completely ignored.  
0
 
LVL 15

Expert Comment

by:spprivate
ID: 20388183
This shows that you people are not readin the post properly,
The first few lines in my comment was the solution.The rest was the reference from SQL Server books online.
Pity that Gurus and Wizards not able to understand this.
0
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 20388697
Hi again,
>The rest was the reference from SQL Server books online.
yes, but plain copy/paste without the reference, so that is 2 problems:
* no reference: although it is obvious that someone else had written that text, and even obvious who, you should have AT LEAST given credits and/or a link.
* copy/pasting entire articles is prohibited by the authors, or do you have the written authorization to copy their articles? if you had, you should have indicated that you have...

please, understand that we do not try to lower you knowledge, but MS (among others) are threathening EE (and others) to control what is being copied from their site/documents to the rest of the internet. they "allow" that extracts can be copied, but not entire pages, and as that was what you did, you violated several rules.

the first lines you posted where fine, and I invite you do continue posting along those lines in the other questions you can answer. but when it comes to copy a full document from an external source, just explain and post the reference, that will be better for all parties.

thanks for your understanding

angelIII, zone advisor
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

PL/SQL can be a very powerful tool for working directly with database tables. Being able to loop will allow you to perform more complex operations, but can be a little tricky to write correctly. This article will provide examples of basic loops alon…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now