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.
Author |
Topic |
kwikwisi
Constraint Violating Yak Guru
283 Posts |
Posted - 2010-08-12 : 01:20:33
|
Table has pair of primary keys and one of them is cluster index.Is it possible to insert duplicate record to cluster index col but another primary key col record will be unique?Coz I'm getting error :Cannot insert duplicate key row in object 'table' with unique index 'indexname' . |
|
slimt_slimt
Aged Yak Warrior
746 Posts |
Posted - 2010-08-12 : 01:34:25
|
can you post DDL of your table. and a sample of what are you trying to insert.obviously you have a constraint set in your primary key that each record must be unique based on two fields. And if you are trying to insert a new record that is same on those two columns (any all the other columns are irrelevant) you get error like you are describing it. |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-08-12 : 11:25:45
|
if you want only composite pk relationship to be maintained, there's no need of unique constraint on column at all------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2010-08-12 : 11:53:25
|
Can you please clarify your terms? There can ONLY be ONE Primary Key on a table. So, we know there are not two. Perhaps that table has a Primary Key and a Unique Constaint or a Composite Primary Key? |
 |
|
X002548
Not Just a Number
15586 Posts |
Posted - 2010-08-12 : 12:01:38
|
quote: Originally posted by kwikwisi Table has pair of primary keys and one of them is cluster index.
<buzzzz> No, I'm sorry...Johnny tell what they have won for playing today</buzzzz>The answer is spam..spam..spam..spam..."shut up..bloody vikings"Post the DDL of your table, and the INSERT statement you are usingBrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
|
|