Global Variable | SQL Server Performance Forums

SQL Server Performance Forum – Threads Archive

Global Variable

I am developing an Asp.Net Project using ASP.Net 2.0 and SQL Server 2005. I need to have some global variable in SQL Server, where to store them, I want to use these global variables in more than one stored procedures. Would anyone help me with a solution

There isn’t any global var in T-SQL.
Alternative solution
– You can pass the variable to the stored procedure that required it from the calling stored procedure
– Use temp table to store the value
Also refer Madhivanan Failing to plan is Planning to fail
You can create a table with two columns. one for variable name and the other for value. by means of a sp pass the variable name as a parameter and get the the vaue —————————————-

Or create a 1 row table with a column for each global variable that you need. You can create an index on each column if you want to. Hope it helps,
Dalton Blessings aren’t so much a matter of recieving them as they are a matter of recognizing what you have received.