i have a table in which i have 2 columns code and description
in first column i have data like 1 - Prevention 2 - Respiratory 3 - Cardiovascular
in 2nd column
NULL NULL NULL
i need to update
only Prevention, Respiratory, Cardiovascular
into 2 nd column
i have written query like this :
update ECT_HEDIS_SubDomain set SubDomainDescription = b.SubDomainDescription from ECT_HEDIS_SubDomain b INNER JOIN ECT_HEDIS_SubDomain a on substring(a.ECTSubDomainCode,1,4) = b.ECTSubDomainCode
Please check your example code as it looks like you are joining the table to itself. Also this will only update where ECTSubDomainCode is four characters or less.