Welcome to MSSQL Forum!
MSSQL Forum - Discussions about Microsoft SQL Server

You are currently viewing our community forums as a guest user. Sign up or
Having an account grants you additional privileges, such as creating and participating in discussions.

SSIS Error: "Meta data for: ... "does not match the metadata for the associated output column"

Discussion in 'Business Intelligence' started by Peter Schmitz, Jun 19, 2017.

  1. Peter Schmitz

    Peter Schmitz Administrator Staff Member

    This morning, I found myself adding some new columns to an existing dataflow that uses a Union All to combine data from 4 different SQL sources. It had been set up so all SQL statements produce the same columns, and I added some default fields to accommodate for the sources that do not have the new columns using something like the following:

    Code (TSQL):

    , 0 AS NewColumn1
    , CAST(NULL AS nvarchar(max) AS NewColumn2
    When then attempting to add the new columns to the Union All component, the error popped up:

    Apparently SSIS is pretty fickle, and you need to explicitly cast the columns to the proper datatype. I did do that with the nvarchar column, but as you can see, not with the bit column. This caused SSIS to cast it as DT_I4 (integer), rather than DT_BOOL.

    You can verify the datatypes by double-clicking the line going from the source to the Union All component, and checing the Metadata page. Another thing to keep in mind is that if you simply change the statement to do the cast:

    Code (TSQL):

    , CAST(0 AS bit) AS NewColumn1
    , CAST(NULL AS nvarchar(max) AS NewColumn2
    That won't work, as the underlying metadata will remain DT_I4. You will have to remove the new columns from the Source, to force the meta data to update, and then re-add them in order to solve the issue.

    When you're done doing this for all data sources, the error ought to disappear, and you can finally set up the columns correctly in the Union All component.

Share This Page

Users found this page by searching for:

  1. error at load data for union all sql the metadata does not match the associated

  2. ssis merge join on dates no have matching metadata