• How many groups (ssn) can you have? Is it reasonable to build the parsing inline or maybe break it up into a temp table based on the sections beginning with "@@T_nnn_"? Suppose you did that and put the results into a temp table with columns Tnnn (containing the @@T number) and Text (containing the text after the = sign.) Then, I think your job might be easier.

    See this article:

    http://www.sqlservercentral.com/articles/Tally+Table/72993/

    Work through the examples, then apply it to break up your input. (HINT, change the @@T to a single character (maybe a tab?) before using the parser). Then you'll have results in a nice table to work with.