Solved

Global Variable in MS SQL?

Posted on 2000-04-04
2
1,600 Views
Last Modified: 2006-11-17
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
0
Comment
Question by:gordan
2 Comments
 
LVL 4

Accepted Solution

by:
Gustavo Perez Buenrostro earned 50 total points
ID: 2685724
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
 
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 2686441
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

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you hear the word proxy, you may become apprehensive. This article will help you to understand Proxy and when it is useful. Let's talk Proxy for SQL Server. (Not in terms of Internet access.) Typically, you'll run into this type of problem w…
Introduction SQL Server Integration Services can read XML files, that’s known by every BI developer.  (If you didn’t, don’t worry, I’m aiming this article at newcomers as well.) But how far can you go?  When does the XML Source component become …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now