x
login about faq Site discussion (meta-askssc)

[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 3 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

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



Facebook logo Follow Ask SSC on Facebook
Find Ask SSC on Google+
linkedin logo Find us on LinkedIn

Topics:

x227
x115

asked: Apr 18 '12 at 09:20 PM

Seen: 311 times

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

Copyright © 2002-2012 Simple Talk Publishing. All Rights Reserved. If you have any queries, please contact the site administrators.
Ask SQL Server Central is a community service provided by Red Gate.