Can I declare global variables?

  • Can I declare a user defined global variable?

    I want to use a variable and to see that variable in many connections.

    Except the spolutions with global temporary tables and execute them into a variable there is other solution for this task?

    Thank you for your answer.

    astefan


    astefan

  • T-SQL has no concept of global variable in the way you described. So the solution you outlined is the way to go. You may however need some careful planning if different connections will be updating the column of the global temporary table at the same time.


    Joseph

  • If you are trying to share variables between stored procedures, have a look at this

    http://www.algonet.se/~sommar/share_data.html

    --Lenard

  • fromnaija is quite right. There is no Global variables concept inbult in SQL Server. However, you can have a table in the master preferably or in the same database, where you can declare values against the variables and subsequently referening this table for desired values to us them in your Store procedures. I am using this logic in my applications.

  • How about using a function?

    RandyHelpdesk: Perhaps Im not the only one that does not know what you are doing. 😉

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply