Hi,I want to rewrite the following update into a select statement to see what value is returned for the set value. update cd set cd.PolicyDetailID = isnull((select top 1 ID from CRM.PolicyDetails pd1 where pd1.PolicyID = pd.PolicyID and pd1.CustomerID = pd.CustomerID and pd1.CoverageID = pd.CoverageID and pd1.ContractID = 3743 and pd1.StateCode = 4 and pd1.StartDate < ISNULL(pd1.EndDate,'30000101') order by pd.ID asc), cd.PolicyDetailID) CD_PolicyDetailID, pd.ID pd_ID, cd.lastupdatedate from clm.Claimdata cdinner join CRM.PolicyDetails pd on pd.ID = cd.PolicyDetailID and pd.CustomerID = cd.CustomerID and pd.PolicyID = cd.PolicyIDinner join crm.policy p on p.id=pd.PolicyIDinner join #MatchingCECD tmp1 on tmp1.cdid=cd.idwhere pd.ContractID = 1201and p.CompanyID = 111
Thanks for the help :)