SQL Server Performance

Global Variable

Discussion in 'SQL Server 2005 General Developer Questions' started by azzamulkhair, Jul 2, 2006.

  1. azzamulkhair New Member

    Hi
    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
    Thanks
    Azzam
  2. khtan New Member

    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


    KH
  3. Madhivanan Moderator

  4. dineshasanka Moderator

    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

    ----------------------------------------
    http://dineshasanka.blogspot.com/
  5. druer New Member

    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.

Share This Page