Sql server 什么';SQL Server SQLCMD mode:setvar的大小限制是多少?

Sql server 什么';SQL Server SQLCMD mode:setvar的大小限制是多少?,sql-server,variables,sqlcmd,Sql Server,Variables,Sqlcmd,我知道在双引号中为字符串包含:setvar命令,但大小限制是多少?它还可以处理多行字符串吗 :SETVAR myWebsiteURL "https://something.somewhere.net" :SETVAR myLongString "This is a long string that goes longer than this box but I am not sure if it will still work in a case like this one where I ju

我知道在双引号中为字符串包含:setvar命令,但大小限制是多少?它还可以处理多行字符串吗

:SETVAR myWebsiteURL "https://something.somewhere.net"
:SETVAR myLongString "This is a long string that goes longer than this box but I am not sure if it will still work in a case like this one where I just keep typing willynilly"

我仍然不知道我的问题的最终答案,但我在SQL Server 2016 SP2中进行了一些测试,发现字符串长度至少可以工作11160个字符,这对于我来说已经足够了。我不知道如何实现多行,但SQLServerManagementStudio查询窗口允许一行至少包含11160个字符

以下是我用来测试的内容(请注意,您需要单引号使其成为有效字符串,并且必须用另一个双引号转义双引号):

:SETVAR myLongString "'This is a long string that goes longer than this box but I am not sure if it will still work in a case like this one where I just keep typing willynilly'"
select $(myLongString)
select len($(myLongString))