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
 SQL Server Development (2000)
 Issue related to clustered index

Author  Topic 

under2811
Constraint Violating Yak Guru

366 Posts

Posted - 2007-08-27 : 07:28:41
Hi,

I created clustered index on three columns of my DB table

Index Name: IX_EmpCode
Index Description: clustered, unique located on PRIMARY
Index Keys: EmpCode, CityID, EffectiveDate

Now I want to insert record in table with all columns values same except EmpCode but I am getting error like

Msg 2601, Level 14, State 1, Line 1
Cannot insert duplicate key row in object 'dbo.Employee' with unique index 'IX_EmpCode'.
The statement has been terminated.

My PK for table Employee is EmpCode.

T.I.A

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-08-27 : 07:47:52
pk automaticaly puts a clustered index on the column.
so your IX.. is a non clustered index.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-08-27 : 21:54:07
You created unique index on those columns, so can't insert dup value to those columns.
Go to Top of Page
   

- Advertisement -