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, 2012 at 09:20 PM in Default

avatar image

binodbabu
290 10 10 15

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

The question has been closed Apr 19, 2012 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

SQL Server Central

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

Topics:

x391
x162

asked: Apr 18, 2012 at 09:20 PM

Seen: 688 times

Last Updated: Apr 18, 2012 at 09:20 PM

Copyright 2016 Redgate Software. Privacy Policy