question

binodbabu avatar image
binodbabu asked

update table

create table #a(col1 char(2), col2 int) insert into #a values('a',1) insert into #a values('b',2) insert into #a values('c',3) insert into #a values('d',4) insert into #a values('e',5) insert into #a values('f',6) create table #b(col1 char(2), col2 int) insert into #b values('a',1) insert into #b values('b',2) insert into #b values('c',3) insert into #b values('x',4) insert into #b values('y',5) insert into #b values('z',6) update #a set #a.col1= #b.col2 from #a join #b on #a.col1=#b.col1 -- it affects ony 3 rows.. i need remaining 3 rows as null) Words are not enough to say thanks to asksqlservercentral team. thanks in advance.
tsqlupdate
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

0 Answers