In T-SQL under MS SQL Server 2008, what does the "@" in front of the * parameter value mean, what is a string literal?

I came across the following code example:

EXECUTE msdb.dbo.sysmail_add_profileaccount_sp @profile_name = @'SQL mail profile', @account_name = @'account name', @sequence_number = 1 ; 

Which means "@" before a string literal, as in the above example:

 @ account_name=@ 'account name' 

I understand that my question may be true for any parameters of the executable module in T-SQL or maybe for any string literal in T-SQL as a whole, so the above is just a concrete example of what I'm looking for.

+6
source share
2 answers

I do not think this is really T-SQL. This could be an artifact of replacing variables with values โ€‹โ€‹somewhere in the script and not trimming the leading @.

+4
source

I get a syntax error with this, so I donโ€™t think it means anything other than that it is an invalid syntax. Have you pulled this from a valid T-SQL that is called using only T-SQL, or is it possibly parameterized material coming from some other language or program?

+2
source

Source: https://habr.com/ru/post/894138/


All Articles