How do I add a varible to column2 when column1 is a specific value (sql-server)

Posted by user367613 on Stack Overflow See other posts from Stack Overflow or by user367613
Published on 2010-06-15T20:08:41Z Indexed on 2010/06/15 20:12 UTC
Read the original article Hit count: 123

How can I do a search for value A in column1 and add a value B in column2?

In other words for every record that column1 has the value A I want to make the value in column2 = B (Currently column2 is empty)

Would this work?

UPDATE MyTable
SET Column2 = REPLACE(Column2,NULL,'B')
WHERE Column1 = "A"

© Stack Overflow or respective owner

Related posts about sql-server

Related posts about query