what are the specific row values that are not coming over;
the WHERE statement you posted has WHERE items that might filter it out, as well as a group by to avoid duplicates:
the grouping on posting_code might be the issue, or the row you think should come over does nto match the WHERE based on any of these criteria:
look at the data for both the row that comes over and the row that does not come over.
do they both share the same substring(posting_code,3,3)?
where Line_No =' + @single_quote + @line_no2 +@single_quote + ')
left(e4w_attribute_code2,2)= ' + @single_quote + @type + @single_quote + '
and (e4w_attribute_code3) ='+ @single_quote + convert(char(1),@processing) +@single_quote + '
group by substring(posting_code,3,3)
--help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!