Author |
Topic |
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2007-10-11 : 08:50:01
|
Hi,I have a float column with Allow Nulls= falseIs it normal that when I try to set the column to 0, i get the error:Cannot insert duplicate key in objectPlease note that the column is part of a primary key and that there is no record with the value of the column 0 in the table in question.Thank you. |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-10-11 : 08:53:20
|
Please post the table definition and INSERT statement in question.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2007-10-11 : 09:08:36
|
The column in question is:UDLNIDI have this index in the table:USE [PRODUCTION]GO/****** Object: Index [F49299_PK] Script Date: 10/11/2007 09:04:25 ******/ALTER TABLE [PRODDTA].[F49299] ADD CONSTRAINT [F49299_PK] PRIMARY KEY CLUSTERED ( [UDDOCO] ASC, [UDDCTO] ASC, [UDKCOO] ASC, [UDLNID] ASC, [UDUPMJ] ASC, [UDTDAY] ASC) ON [PRIMARY]:and this key USE [PRODUCTION]GO/****** Object: Index [F49299_PK] Script Date: 10/11/2007 09:05:35 ******/ALTER TABLE [PRODDTA].[F49299] ADD CONSTRAINT [F49299_PK] PRIMARY KEY CLUSTERED ( [UDDOCO] ASC, [UDDCTO] ASC, [UDKCOO] ASC, [UDLNID] ASC, [UDUPMJ] ASC, [UDTDAY] ASC) ON [PRIMARY]There re no constraints in the table.Thanks. |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-10-11 : 09:14:15
|
The primary key IS a contraint too.You can't have duplicate values in the primary key. E 12°55'05.25"N 56°04'39.16" |
 |
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2007-10-11 : 09:20:47
|
yes but no record has the value 0 for the column in question: UDLNIDso why does it say it s a duplication attempt? |
 |
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-10-11 : 09:27:15
|
Do you have trigger on the table? or any check constraint?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
Kristen
Test
22859 Posts |
Posted - 2007-10-11 : 09:58:29
|
"Cannot insert duplicate key in object"Does the message say WHICH object?Might be something else - e.g. the target of a Trigger action.Kristen |
 |
|
jezemine
Master Smack Fu Yak Hacker
2886 Posts |
Posted - 2007-10-11 : 10:11:26
|
i don't know about you guys, but the name of his database has me worried! elsasoft.org |
 |
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2007-10-11 : 10:45:14
|
Here is a last post I did in msdn:Re: sql 2000: does float column allow 0 when Allow Null=false hahahaha dear moderator, u got it my friend, m so stu..... oh noI was trying to update several rows with the same value, so obviously that s not gonna work since it s a primary key. Oh nooooooooooooooooooooooo Thanks a lot Thanks a lot for your help guys of sqlteam |
 |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-10-12 : 01:58:02
|
See post made 10/11/2007 : 09:14:15 E 12°55'05.25"N 56°04'39.16" |
 |
|
rtutus
Aged Yak Warrior
522 Posts |
Posted - 2007-10-12 : 08:42:02
|
quote: Originally posted by Peso See post made 10/11/2007 : 09:14:15 E 12°55'05.25"N 56°04'39.16"
I Totally agree Peso :)I didn t read it carefully, (may be my ADD symptom :) ) |
 |
|
|