Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Why should we lock variable before access it in the script task Expand / Collapse
Author
Message
Posted Saturday, October 12, 2013 1:37 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Friday, January 10, 2014 4:43 AM
Points: 15, Visits: 44

Hi everyone,

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

Thanks in advance,
Sharmi
Post #1504184
Posted Tuesday, October 22, 2013 3:57 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Friday, July 25, 2014 2:48 AM
Points: 386, Visits: 623
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.

Post #1507038
Posted Tuesday, October 22, 2013 4:59 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Today @ 6:29 AM
Points: 13,271, Visits: 10,150
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.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #1507052
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse