[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

IDENTITY_INSERT is set to OFF.

Posted on 2007-12-01
14
Medium Priority
?
4,562 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
[X]
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
  • 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 500 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 500 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
Plesk WordPress Toolkit

Plesk's WordPress Toolkit allows server administrators, resellers and customers to manage their WordPress instances, enabling a variety of development workflows for WordPress admins of all skill levels, from beginners to pros.

See why 2/3 of Plesk servers use it.

 
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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
Viewers will learn how the fundamental information of how to create a table.

656 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