Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 does float column allow 0 when Allow Null=false

Author  Topic 

rtutus
Aged Yak Warrior

522 Posts

Posted - 2007-10-11 : 08:50:01
Hi,
I have a float column with Allow Nulls= false
Is it normal that when I try to set the column to 0, i get the error:

Cannot insert duplicate key in object

Please 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 Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

rtutus
Aged Yak Warrior

522 Posts

Posted - 2007-10-11 : 09:08:36
The column in question is:
UDLNID

I 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.
Go to Top of Page

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"
Go to Top of Page

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: UDLNID
so why does it say it s a duplication attempt?
Go to Top of Page

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 Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

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
Go to Top of Page

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
Go to Top of Page

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 no

I 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
Go to Top of Page

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"
Go to Top of Page

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 :) )
Go to Top of Page
   

- Advertisement -