How to use a string that contain single quotes '
Problem: Incorrect syntax near ' +
Solution: duplicate the single quotes '' ''
DECLARE @sql nvarchar(max)
SET @sql =
'SELECT employee, FLastName + '' '' +SLastName + '' '' + FName + '' '' +SName + '' ''
AS Employee_name
'
Note: This example not contains the validation with CASE WHEN IS NULL.
No comments:
Post a Comment