I have come across the following example code:
我遇到了以下示例代码:
EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = @'SQL mail profile',
@account_name = @'account name',
@sequence_number = 1 ;
What does '@' mean in front of the string literal, as in the example above:
'@'在字符串文字前面的含义是什么,如上例所示:
@account_name=@'account name'
I understand that my question may stand true for any executable module's parameters in T-SQL, or maybe for any string literal in T-SQL in general, so the above is just a concrete example of what I'm looking at.
我理解我的问题可能适用于T-SQL中的任何可执行模块的参数,或者可能对于T-SQL中的任何字符串文字都是如此,所以上面只是我正在看的具体示例。
2 个解决方案
#1
4
I do not think that this is valid T-SQL. This may be an artifact of replacing variables with values somewhere in a script and not trimming the leading @.
我不认为这是有效的T-SQL。这可能是用脚本中某处的值替换变量而不是修剪前导@的工件。
#2
2
I get a syntax error with that, so I don't think it means anything except that it's not valid syntax. Did you pull that from valid T-SQL that is being called using just T-SQL, or perhaps this is parameterized stuff coming from some other language or program?
我得到了一个语法错误,所以我不认为这意味着什么,除了它是无效的语法。你是从那些仅使用T-SQL调用的有效T-SQL中提取的,或者这可能是来自其他语言或程序的参数化内容?
#1
4
I do not think that this is valid T-SQL. This may be an artifact of replacing variables with values somewhere in a script and not trimming the leading @.
我不认为这是有效的T-SQL。这可能是用脚本中某处的值替换变量而不是修剪前导@的工件。
#2
2
I get a syntax error with that, so I don't think it means anything except that it's not valid syntax. Did you pull that from valid T-SQL that is being called using just T-SQL, or perhaps this is parameterized stuff coming from some other language or program?
我得到了一个语法错误,所以我不认为这意味着什么,除了它是无效的语法。你是从那些仅使用T-SQL调用的有效T-SQL中提取的,或者这可能是来自其他语言或程序的参数化内容?