Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

IDENTITY_INSERT is set to OFF.

Posted on 2007-12-01
14
4,556 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
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
 
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 143

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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL create line numbers for data sampling 11 27
Run Stored Procedure uisng ADO 5 20
Comparison query - 4 columns 9 23
SQL Availablity Groups List 2 7
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
I have a large data set and a SSIS package. How can I load this file in multi threading?
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…
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.

839 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