x

[Closed] 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.
more ▼

asked Apr 18 '12 at 09:20 PM in Default

binodbabu gravatar image

binodbabu
290 7 10 12

(comments are locked)
10|1200 characters needed characters left

The question has been closed Apr 19 '12 at 01:41 AM by KenJ for the following reason:

Duplicate Question - http://ask.sqlservercentral.com/questions/88607/update-table.html

0 answers: sort voted first

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x264
x128

asked: Apr 18 '12 at 09:20 PM

Seen: 488 times

Last Updated: Apr 18 '12 at 09:20 PM