Reputation: 3
I want to use the Production.Product table to return product name, color and list price for each product. For the color column, where there is NULL, replace it with the string Unknown.
Upvotes: 0
Views: 450
Reputation: 510
If you just want to select color with 'Unknow'
you could use IsNull to replace the Null value
select name, IsNull(color,'Unkown') as color from Production.Product
Its another way to thinking your problem.
Upvotes: 2
Reputation: 14460
SELECT productname, ISNULL(color,'Unknown') as color,listprice
FROM Production.Product
Upvotes: 0
Reputation: 520878
I think you just a single UPDATE
statement here:
UPDATE Production.Product
SET color = 'Unknown'
WHERE color IS NULL
Upvotes: 1