Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Global Variables
Message
 
 
To
19/12/2000 17:27:02
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
00455255
Message ID:
00455337
Views:
33
>I am looking at someone elses stored procedure code and they are using @@ in front of their variables instead of @. Is there any good reason to do this. Does this make the parameter global? They said that they need to do this because of Output variables, but I can't understand why. I thought that @@-variables were used for system variables only (like @@rowcount.)

AFAIK, you can't create a global variable. Local variables are created using a @ as the first character. There is nothing to prevent a developer from adding a second @ if they want. It's just a preference.

Output parameters are designated using the OUTPUT keyword so no, @@ doesn't designate a variable as an putput variable.

FWIW, the only double symbol notation I know of that dynamically configures anything is ##. The # symbol designates a temporary table. A table created using this is temporary to the connection that created it. In addition, if it was created within an SP, it automatically goes away when the SP ends. If you use ## when creating it, the temporary table is visible for all connections and doesn't go away until dropped.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform