Error: The type of the value being assigned to variable "User::VARName" differs from the current variable type.

  • BIDS 2008.  I need to create a bunch of text files inside ForEach loop in SSIS Package. 1 file is being populated. But no iteration happens.

    While executing package package fails.  Error: The type of the value being assigned to variable "User::SchoolName" differs from the current variable type.
    It drives me nuts. 
    The  column datatype in SQL server is Varchar (60) , it is correctly assigned from a valid recordset. See attached images. all matches.
    How can I correct such error?

    Really appreciate your advice.
                  (when I changed SchoolName variable declaration datatype to Object i got a 1000 more errors at very start of execution of the package, so I changed it back to string.).

    Likes to play Chess

  • To assist others, here are in-line versions of those images:




    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Can you also post a screen shot of the General page for the foreach loop container?

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Sure. a few screenshots. No expressions.

    Likes to play Chess

  • I can't see a single issue with what you are doing.
    Have you tried setting breakpoints on the Foreach loop and the Output File tasks (select them and press F9) and then running the package? That should allow you to inspect the runtime values of some relevant local variables, which may reveal something. It would also be interesting to know whether the job fails on the very first iteration of the loop?

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • Need to check 2 things here:
    1) If there consists variables(SchoolName) with same name but in different scope
    2) If the query to get school name bringing any NULLs.

    @Phil please correct me if i am wrong 🙂

    BI Developer
    SSRS, SSIS, SSAS, IBM Cognos, IBM Infosphere Cubing services, Crystal reports, IBM DB2, SQL Server, T-SQL
    Please visit... ApplyBI

  • H4K - Monday, July 30, 2018 12:24 PM

    Need to check 2 things here:
    1) If there consists variables(SchoolName) with same name but in different scope
    2) If the query to get school name bringing any NULLs.

    @Phil please correct me if i am wrong 🙂

    Checking variable scopes is an excellent idea. To help with this, click on the Grid Options button and select 'Show variables of all scopes':

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

Viewing 7 posts - 1 through 6 (of 6 total)

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