locked
variable value RRS feed

  • Question

  • I need to dynamically assign value to a package scoped variable.  The package has a Control Flow task that imports data from an Excel Source into a OLEDB Destination.  After that Data Flow task, there is a Execute SQL where I need to get the SiteID column from the first row of the imported data table and assign the SingleRow result to the variable.  The following is the setting in the Execute SQL Task Editor, but the task always fails with "Error at Assisgn SiteID with SiteID variable: Failed to lock variable "User::SiteId" for read access with error 0xC0010001 "The variable cannot be found."  Thank you for your help.

    General tab: 
    ConnectionType: ADO.Net
    ResultSet: Single row
    SQLSourceType: Direct input
    SQLStatement: Select Top 1 SiteID as SiteIDResult from tblImported
    IsQueryStoredProcedure: false 

    Result Set tab:

    ResultName: SiteIDResult
    VariableName: User::SiteId 

     

    Tuesday, March 22, 2011 8:57 AM

Answers

  • Hi,

    Change the Variable type to Object and try executing the package again.

    Try this !!

    Thanks,

    Guru

    • Marked as answer by jsjs Wednesday, March 23, 2011 3:27 AM
    Tuesday, March 22, 2011 9:07 AM

All replies

  • Do you have any scripts in that package?

    OR

    Check you have declared this variable in your variable list (please check the scope of the variable also)



    Let us TRY this |

    My Blog :: http://quest4gen.blogspot.com/
    Tuesday, March 22, 2011 9:05 AM
  • Hi,

    Change the Variable type to Object and try executing the package again.

    Try this !!

    Thanks,

    Guru

    • Marked as answer by jsjs Wednesday, March 23, 2011 3:27 AM
    Tuesday, March 22, 2011 9:07 AM
  • Change the Variable type to Object and try executing the package again.

    " I need to get the SiteID column from the first row of the imported data table and assign the SingleRow result to the variable" states that only one value is captured and so single row result set should be fine.One more thing that I would like to do is to change the result name to 0 and test the package:

    Result Set tab:ResultName: 0 and VariableName: User::SiteId 


    Nitesh Rai- Please mark the post as answered if it answers your question
    Tuesday, March 22, 2011 9:21 AM