I am trying to create a stored procedure which will concatenate a SQL statement which will then be executed , al la
DECLARE @sql nvarchar(max)
generate statement - concatenate string into @sql
EXEC @sql
It needs to contain this as part of the where clause:
S.Name_Last , ISNULL(', ' + S.Name_First, '')
Problem I am having is stringing along this part of the select clause into the select statement, i.e. the number of "ticks" needed to successfully concatenate the ISNULL part of the select statement. No matter what I try, cannot get the right "tick" count to imbed the single quote into my statement.
Any suggestions?