Hi,

The error is on the following line, it complaining about the comma within the double quotes:

select @fullname='nm_last'","'wpat.nm_first'

Since its a string you'll need to either:

a) have the whole column(s) within a string eg,

select @fullname='nm_last, wpat.nm_first'

b) concatenate the strings. eg,

select @fullname=='nm_last' + ',' + 'wpat.nm_first'