sql - Error when executing a stored Procedure -
i trying execute stored procedure failing while inserting data 1 table table. error
cannot insert duplicate key row in object 'extpndpart1' unique index 'idx_primary'
i know error comes when destination table has primary key on particular column , source table has duplicates in column. hv condition drops primary key in stored procedure.
if exists (select * dbo.sysindexes name = n'pk_extpndpart1' ) alter table [dbo].[extpndpart1] drop [pk_extpndpart1]
can 1 me??
seems you're looking for/dropping wrong index. you're dropping pk_extpndpart1
error refers idx_primary
.
Comments
Post a Comment