Home Forums SQL Server 2005 T-SQL (SS2K5) Update and Except question. RE: Update and Except question.
Lynn Pettis
SSC Guru
Points: 442467
More actions
July 8, 2015 at 12:16 pm
#1811100
Or something like this:
with Obsolete as (
select
c1,
c2
from
dbo.tblOld
except
dbo.tblNew
)
update t set
obsolete = 1
dbo.tblOld t
where
exists(select 1 from Obsolete o where o.c1 = t.c1 and o.c2 = t.c2);