MAX ( CASE WHEN PERSON_LS.POS = 2 AND PERSON_LS.REUNION_CLASS IS NOT NULL THEN PERSON_LS.REUNION_CLASS END ) AS [Reunion Class 2],I would use
MAX ( CASE WHEN PERSON_LS.POS = 2 AND PERSON_LS.REUNION_CLASS IS NOT NULL THEN PERSON_LS.REUNION_CLASS ELSE NULL END ) AS [Reunion Class 2],Again, this should not prevent your procedure from working properly. If you comment out 3 lines after your comment line reading -- insert fresh then your insert will become a select of the data from the table variable. Now you can execute the proc: exec [dbo].[SP_PERSON_LS_PREP]; and you should see the records in results. If you do then there is nothing wrong with the proc, you just need to make sure that something calls it to actually execute.
9 People are following this question.