[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 4565
  • Last Modified:

IDENTITY_INSERT is set to OFF.

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
Panos
Asked:
Panos
  • 6
  • 4
  • 2
  • +1
2 Solutions
 
_agx_Commented:
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
 
_agx_Commented:
> 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
 
imitchieCommented:
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
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
_agx_Commented:
Was that not just what I said? :)
0
 
imitchieCommented:
I find examples a lot clearer, same for SQL, C#, C++, PHP or just anything really.
0
 
_agx_Commented:
Umm.. yes, that's why I included one ;-)
0
 
imitchieCommented:
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
 
_agx_Commented:
> then i saw the essay from the other comment
(rofl)

No problem :)
0
 
spprivateCommented:
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
 
imitchieCommented:
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
 
_agx_Commented:
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
 
spprivateCommented:
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
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
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

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 6
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now