October 15, 2018 at 5:14 pm
The website below says that @@TRANCOUNT is a function. But I read somewhere else that @@ is used to indicate a global variable. How can a variable also be a function?
http://www.dailyfreecode.com/code/trancount-trancount-function-437.aspx
October 15, 2018 at 6:21 pm
The official documentation refers to them as functions. I suspect the fact they act a bit like variables, have similar syntax and the fact the correlation with ## and # tables has lead to people calling them global variables, even though they really aren't.
October 15, 2018 at 8:33 pm
andycadley - Monday, October 15, 2018 6:21 PMThe official documentation refers to them as functions. I suspect the fact they act a bit like variables, have similar syntax and the fact the correlation with ## and # tables has lead to people calling them global variables, even though they really aren't.
Thank you for clarifying. Then just to be sure, what does the @@ indicate?
October 16, 2018 at 5:08 am
Nothing. It has no special meaning by itself.
This works fine, but has no meaning difference to any other variableDECLARE @@i INT
SET @@i = 1;
SELECT @@i
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply