update table1
set table1.range=case
when table1.wt>=cast(substring(table2.range1,1,charinde x('-',table2.range1)-1) as int)
and table1.wt<=cast(substring(table2.range1,charindex( '-',table2.range1)+1,99) as int)
then table2.range1
when table1.wt>=cast(substring(table2.range2,1,charinde x('-',table2.range2)-1) as int)
and table1.wt<=cast(substring(table2.range2,charindex( '-',table2.range2)+1,99) as int)
then table2.range2
else table1.range
end
from table2
where table2.id=table1.id