Global Variables for SQL SERVER 2005

  • I feel like a freaken idiot asking this :hehe: but searching the web didn't bring up any logical answer to this.

    Scenario: Two Systems, one Database. The one system (System A) inserts data into tables, the other system (System B) reads the data from the tables. I want to ensure that System B does not start reading from the tables untill System A has finished insertion of data.

    I was thinking in the direction of a global variable serving as a flag. System B will not read data until System has set the flag to TRUE. This value should if possible be able to stay in memory or stored in some form to refer to again later.

    I know I could probably lock tables, create status tables etc etc. But having something simular to a Global Variable would be perfect for my specific scenario.

    Any Ideas?

    [font="Courier New"]-----------------------------------------------------------------------------------------------------------------------
    😀 Arguing with Programmers are like wrestling a pig in mud, soon you realize the pig is enjoying it. 😀
    -----------------------------------------------------------------------------------------------------------------------[/font]

  • Stating the obvious: I assume you can't simply have system one call system two when it has completed the loads?

    Otherwise no although I would want this sort of thing persisted in a status table anyway (always good for auditing\ troubleshooting)

  • You could use application locks:

    http://www.sqlteam.com/article/application-locks-or-mutexes-in-sql-server-2005

    -- Gianluca Sartori

  • @ hallidayd - sending message between the two system is possible but for the unique way the two system operate it wouldn't really work.

    Seems like the best solution would be to create a table of status where system A would manage the value and system B could read it an ddetermine whether it can carry one with it normal reading process.

    Thanks Guys

    [font="Courier New"]-----------------------------------------------------------------------------------------------------------------------
    😀 Arguing with Programmers are like wrestling a pig in mud, soon you realize the pig is enjoying it. 😀
    -----------------------------------------------------------------------------------------------------------------------[/font]

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

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