I have 2 tables in my SQL Server (These were created by Microsoft CRM)

Table 1 is ActivityPointer Base (po for short)
Table 2 is ActivityPartyba se (pa for short)

First:

Loop begins with grabbing the first row from po.
IF TypeCode = 4201 great! Start the second loop
grab the first row of pa and test
if po.activityID = pa.activityID AND po.OwningUser = pa.ActivityPart yID...