Solved

Global Variable in MS SQL?

Posted on 2000-04-04
2
1,621 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 143

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

636 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