I need to take a month and day field in a table, and update a new date field, based upon the month and year. I tried this query, which says it updates the records, but none of the date fields are updated. Can someone tell me what is wrong with the query or suggest a better one? Thanks.
UPDATE dbo.pd_products
SET launch_date =
(select cast( B.launch_year + '-' + B.launch_month + '-' + '1' AS datetime)
from dbo.pd_products as B
where B.product_key = product_key
and B.launch_date = launch_date)
where substring(launch_year,1,1) != ' '
and substring(launch_month,1,1) != ' '
UPDATE dbo.pd_products
SET launch_date =
(select cast( B.launch_year + '-' + B.launch_month + '-' + '1' AS datetime)
from dbo.pd_products as B
where B.product_key = product_key
and B.launch_date = launch_date)
where substring(launch_year,1,1) != ' '
and substring(launch_month,1,1) != ' '