you can change
SELECT @pubID,
(SELECT entity_item_id from #TMPTABLE WHERE acc_no = '608' AND entity_id = @progID),
(SELECT entity_item_id from #TMPTABLE WHERE acc_no = '11606' AND entity_id = @orgID),
GETDATE(),@userId,@relSupp,1,'Fuel cooled oil cooler'
to
select @pubID,
max(case when acc_no = '608' then entity_item_id end),
max(case when acc_no = '11606' then entity_item_id end),
GETDATE(), @userId, @relSupp, 1, 'Fuel cooled oil cooler'
from #TMPTABLE
where acc_no in ('608', '11606')
and entity_id = @progID
does all your union query basically the same ? only the acc_no = 'xxx' part that varies ?
KH
Time is always against us