Why should we lock variable before access it in the script task

  • Hi everyone,

    Could you please tell me Why should we lock variable before access it in the script task?

    Thanks in advance,

    Sharmi

  • sounds like homework to me...

    You want to lock the variable so that no other process can change the value whilst your script runs, otherwise any logical processing you do may be affected by the change in value leading to unexpected results which woudl be really difficult to debug.

    Also, I am not sure that you can change the value of a variable within the script unless you have it locked for write.

  • aaron.reese (10/22/2013)


    Also, I am not sure that you can change the value of a variable within the script unless you have it locked for write.

    I never lock variables. Never ran into an issue either.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP

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

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