I am looking to incorporate replace statements in a case statement. I have a view which produces the data that need and I have a query that updates fields in one table from another table. I would like to use this query in a CASE statement.
This is how I am updating wtih the query:
set OrgID = REPLACE(a.OrgID,b.[OLD CC ID],b.[NEW CC ID]),
AccountID = REPLACE(a.AccountID,b.[closed SBU ID],b.[NEW SBU ID]),
Alias = REPLACE(a.Alias,b.[closed SBU ID],b.[NEW SBU ID])
from Master_Hierarchy a inner join CloseCons b
on a.OrgID = b.[OLD CC ID]
I am thinking something along the lines of:
WHEN a.client_sbu = b.[closed SBU ID] Then b.[NEW SBU ID]
END as 'client_sbu'
However I want to do this in a view. Is this even possible?