SSIS invalid datatype

Ken K 0 Reputation points
2026-11-25T17:52:04.2533333+00:00

I have a mapping in SSIS between two tables that both contain a column defined as a date. When creating the source query SSIS defines the date column as a WSTR datatype. I added a cast as date to the query and defined the resulting column as a date. When mapping to the target table which also contains a date field that is defined as a date SSIS always changes it to a WSTR. I tried to change it directly in the Advanced Editor but it results in an invalid metadata flag and SSIS changes it back. Is this a new Microsoft feature to convert all dates to WSTR datatypes or is there a way to map a date field to another date field? The real problem occurs if I try to run this defined as a WSTR that I get a data type mismatch on the target table.

SQL Server Integration Services
0 comments No comments

1 answer

Sort by: Most helpful
  1. AI answer

    2026-11-25T17:55:00.09+00:00

    Check the OLE DB connection managers’ provider and, if they use SQLOLEDB/SQLOLEDB.1 or SQLNCLI, replace them with MSOLEDBSQL19, then recreate the source and destination metadata.

    Replace the legacy provider

    This is not a feature that intentionally converts every date to text. Down-level OLE DB metadata exposes SQL Server date as DBTYPE_WSTR(10), which SSIS represents as DT_WSTR; that exactly matches the behavior described.^1^

    1. In the SSIS designer, locate Connection Managers at the bottom of the package.
    2. Right-click each SQL Server OLE DB connection → Properties or Edit and inspect its provider.
    3. If it is SQLOLEDB, SQLOLEDB.1, SQLNCLI, or SQLNCLI11, install the current Microsoft OLE DB Driver if it is not listed, and create a new OLE DB connection manager using:
      • Microsoft OLE DB Driver 19 for SQL Server (MSOLEDBSQL19), preferably; or
      • Microsoft OLE DB Driver for SQL Server (MSOLEDBSQL).

    MSOLEDBSQL19 is the current provider recommended for new and existing applications. SQLOLEDB is no longer maintained, while SQL Native Client is removed from SQL Server 2022 and is not recommended for new development.^2^ Microsoft’s VS 2022 SSIS guidance likewise recommends the Microsoft OLE DB Driver rather than SQLOLEDB or SQL Native Client.^3^

    If Driver 19 introduces a certificate/encryption connection error, configure its connection security settings appropriately for the server rather than reverting to SQLOLEDB.

    Rebuild the cached SSIS metadata

    Changing the Advanced Editor’s output type is not the correct fix: the component validates that value against metadata supplied by the provider and changes it back.

    After creating the new connection managers:

    1. Point the OLE DB Source and OLE DB Destination at the new connections.
    2. Because SSIS can retain the metadata obtained when a component was first configured, delete and recreate the affected source and destination components if merely changing their connection does not refresh the columns.^4^
    3. Re-enter the source query. A normal projection is sufficient:
    SELECT
        PrimaryKey,
        DateColumn
    FROM dbo.SourceTable;
    
    1. Open the source Advanced Editor → Input and Output Properties → OLE DB Source Output → Output Columns.
    2. Confirm the date column is now DT_DBDATE, not DT_WSTR.
    3. Open the destination, select the target table again, and rebuild the Mappings.
    4. Run the package.

    SQL Server date maps to SSIS DT_DBDATE, which contains year, month, and day.^5^ The current OLE DB driver supports DBTYPE_DBDATE mapping to SQL Server date.^6^

    Do this for both connections if the source and destination use separate connection managers—the provider selected by each manager controls the metadata seen by its corresponding component.^7^

    If the provider is already MSOLEDBSQL19

    If both components already use MSOLEDBSQL19, the available information does not establish another specific cause. Capture these details next:

    • Exact SSIS Projects extension version from Extensions → Manage Extensions → Installed.
    • Source and destination connection strings with credentials and server names removed.
    • Source output type and destination external-column type from each component’s Advanced Editor.
    • The full validation/runtime error text.

    Do not continue forcing the type in Advanced Editor. The OLE DB destination requires compatible input and target types, so a DT_WSTR input discovered through incorrect metadata can fail when mapped to a date destination.^8^


    References

    1. New Date and Time Features with Previous SQL Server Versions (OLE DB)
    2. Microsoft OLE DB Driver for SQL Server
    3. SSIS Projects Extension for Visual Studio 2022+ Troubleshooting Guide - SQL Server Data Tools (SSDT) | Microsoft Learn
    4. Problem with SSIS package - Microsoft Q&A
    5. Integration Services Data Types
    6. Data Type Support for OLE DB Date and Time Improvements
    7. OLE DB Source - SQL Server Integration Services (SSIS) | Microsoft Learn
    8. OLE DB Destination
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.