Miss-mapped columns in SSIS

Jeff 11 Reputation points
2020-12-10T18:55:29.767+00:00

I have a simple ETL that is selecting columns from tables in one SQL Server database and inserting them into a table in another SQL Server db. The ODBC Source uses a SQL Query. The ODBC Destination is loading directly to the table. All is working perfectly, no error messages, except that the data is being inserted into the wrong columns in two cases.

The select: SELECT SerialNumber, IPAddress... loads the serial number into the IPAddress field in the destination and the IPAddress into the SerialNumber field.

The mapping tab is correct, as far as mapping SN to SN and IP to IP, but there is something odd about it. The destination table columns are not shown in the order they should be, i.e. the table's first column is SN and the second is IP, but the ODBC Destination mapping tab shows IP first and SN second. So when I map SN to SN I suspect that what I'm actually doing is mapping SN from the query to the second column of the table, which is actually IP (and vice versa). The columns are different length varchars, so I can switch the mapping and it'll work, but it will warn me that the data may not fit in the column due to the size difference. It would also be damn confusing for anyone trying to troubleshoot my code at some future date.

Any thoughts?

ENV:
Visual Studio 2019
SQL Server 2016

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
5,221 questions
SQL Server Integration Services
SQL Server Integration Services
A Microsoft platform for building enterprise-level data integration and data transformations solutions.
2,600 questions
{count} vote

6 answers

Sort by: Most helpful
  1. Clemmo 0 Reputation points
    2024-10-02T16:26:55.45+00:00

    I had the same problem. I solved it by creating a new query with the same column order as the columns in the source table.

    0 comments No comments

Your answer

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