这看起来很简单...
如何存储多行字符串,以便代码保持良好的格式。
这样做是丑陋的
DECLARE @myStr NVARCHAR(MAX)
SET @myStr = 'This represents a really long
string that i need multiple lines for,
dude.'
但以上结果是正确的字符串输出:
SELECT @myStr
'This represents a really long string that i need multiple lines for, dude.'
这样做可以更轻松地阅读我的代码:
DECLARE @myStr NVARCHAR(MAX)
SET @myStr = 'This represents a really long
string that i need multiple lines for,
dude.'
但结果是:
SELECT @myStr
'This represents a really long string that i need multiple lines for,
dude.'
是否有一些特殊的方法来转义多行字符串中的制表符(就像其他所有语言一样)。
您要查找反斜杠 ("\"):
SET @myStr = 'This represents a really long
string that i need multiple lines for,
dude.'