Global Variable in MS SQL?

Is there global variable on
MS SQL 7? Or, is there anything
to use instead global variable?
When I say global variable, I mean
variable that last during one session.

Thanks
gordanAsked:
Who is Participating?
 
Gustavo Perez BuenrostroConnect With a Mentor Commented:
gordan,

You cannot create your own global variables. Remember that global variables are predefined and maintained by the MS-SQL.

The only way to resolve this problem is creating a table in which you must store the values of all your “global” variables and use a stored procedure to get the values from this table whenever you need them.

To get more detail see:

-"variables" definition on Glossary of BOL.
-Question 10198058 on EE:
http://www.experts-exchange.com/jsp/qShow.jsp?ta=mssql&qid=10198058 
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
As your "global variables" only need to be maintained during a session, your tables can be temporary tables (##GlobalVars), that will be dropped automatically when session ends..
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.