select top 1
id, word, length
from words
order by abs(length - 5) asceding
insert into b (.....)
select * from temp where temp.field not in (select distinct field from a)
insert into b (.....)
select * from temp
left join a on temp.field=a.field
where a.field is null