views:

27

answers:

1

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"
A: 
UPDATE MyTable
SET Column2 = 'B'
WHERE Column1 = 'A'

Use that instead.

Ohh, and welcome to Stack Overflow!

Meiscooldude
You'll need single quotes for SQL-Server. By the way, why use the like operator in this query?
Martin Milan
try: `UPDATE MyTable SET Column2 = 'B' WHERE Column1 = 'A'`
KM