SQL Server Performance

Global Variable

Discussion in 'SQL Server DTS-Related Questions' started by danny123, Jan 19, 2007.

  1. danny123 New Member

    Hi there...

    In a DTS package the First step is activeX script in which it gets the values for 3 global variables .For example Maximum custId and in later steps selects all the values which are greater then tht maxCustID.But my question is when i do the same query like everything which is greater then tht value....it does not give me any record. And thats obvious also as thts the max id.Does this mean that global var. keep the value from last run.And gets al the records which are added after the last run. but getting the values for global var. is the first step of package. so it shd replace the old values.
    I am totaly confused how this is whole working can some body please provide some clue.
    This job runs every one hour.

    Thanks
    Danny

    "We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true."
  2. mdefehr New Member

    I'm pretty sure global variable values don't persist between runs - if you set the value then save the package it persists, but if you set the value at runtime, the value will only be there during that run - next run it will start as the value was when the package was last saved - in other words, the value is saved with the package definition...

    ...but it sounds like the variables are being set in the first step anyway.

    I would suggest going into the design of your package without running it and checking the values of the global variables (be sure nothing is selected, then go Package|Properties - Global variables tab) - this is what the values will always start out as - then, run your activeX script (right click - execute step), then check the values of the global variables again and be sure what you expect to happen happens (I've only set global variables with an execute SQL task so I'm not sure how to do it with ActiveX)

    Assuming the values are what you expect, ensure they are being used properly in subsequent steps - this can be a little tricky with the question marks and assigning them to parameters and such

    Hope this gives you some ideas anyway...

    MDD

Share This Page