Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Enable/Disable global variables from a procedure
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
00192854
Message ID:
00193974
Views:
17
>How can one create a global variable in SQLSERVER? I would like to be able to create a global variable from within a procedure, and then have other procedures read the value of that variable, and take certain action on it. More specifically I would like to enable / disbale a trace_flag from withing a procedure and then based on the value of this flag, display a debugging message or not.

SQL Server does not support global variables. Could you create a control table for you application and write a row for your SPID. Then you could place whatever flags your application needs in there. Later, create a job that would remove rows for SPIDs that are no longer active.

HTH

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Previous
Reply
Map
View

Click here to load this message in the networking platform