You forgot one of the plus signs. Try this:
Code:
SELECT @sql = 'SELECT candidate_last_name, candidate_first_name
FROM vw_applicationDetail
WHERE application_status_id = ' + CAST(@statusCode As varchar(10)) +
'AND current_status_ind = ' + CAST(@currentStatus As varchar(10)) + ' ' +
'AND application_deleted_ind = 0 '
Also you were missing a closed parentheses. I checked this in query analyzer. It works now
