SQLTeam.com | Weblogs | Forums

Update record

declare @temp table
(
id int,
code int
)

insert into @temp values(1,10000)
insert into @temp values(1,10001)
insert into @temp values(2,10000)

the above insertion is valid but when i try to update the 2nd record
as id = 1 and code = 10000 it should not update since we have already an record inserted into table that is 1st record.

can one please help without using merge.

what is the PK of the table? You need to use those when updating or show what your update is. What are you trying to accomplish? Is Code also part of the primary key?

use unique constraint on id and code columns together