I have a table call CaseTypeCode with 2 columns: typeCode and caseType. Assuming that the CaseTypeCode table has been populated with all possible case types and each case type has been assigned a type code, replace the column caseType in the Case table with a new column typeCode. Add the correct type into the existing rows in the Case table to refer to the corresponding typeCode given the caseType of the case.
I have created a new column caseType in Case table, but it's now filled with NULL. I need to fill them with the caseType from CaseTypeCode. A subquery like below won't work because the subquery result in multiple output. I think I need a correlated subquery.
update [Case]
set [Case].typeCode =
(select ctc.caseType
from [CaseTypeCode] as ctc
where ctc.caseType=[Case].caseType);