I want something like
DECLARE myVariable nvarchar[MAX] = "hello world".
Bonus points if you show me how to encode a quote in the string.
E.g.:
I want the string to read
John said to Emily "Hey there Emily"
my attempt would be
DECLARE myVariable nvarchar[MAX] = "John said to Emily \"Hey there Emily\""
Here goes:
You will note that the
'is escaped by doubling it to''.Since the string delimiter is
'and not", there is no need to escape":The second example in the MSDN page on
DECLAREshows the correct syntax.