0

I am using VS 2008 to create an SSIS package and I am finding the same package is importing data differently when the package is moved to a different machine.

In my SSIS package I have a script task which is first to run, and it runs fine. The next step is to take CSV files (created in the script task) and import them into the database. To test this I do the following in VS:

Build my solution Build my SSIS package Run the SSIS package from VS

All of this works fine. So I then go to my bin folder where the DTSX file is and I then create a SQL job out of that package.

When I run this package I notice it is failing and when I dig deeper, it is failing because the data being imported from the CSV files has the quotes imported into the table as well, like this:

PolicyNumber    FamilyMemberID  LastName
"000001"            "A"         "Wilkinson"
"000001"            "Z"         "Wilkinson"
"000002"            "R"         "Trujillo"

It should look like this:

PolicyNumber    FamilyMemberID  LastName
000001              A           Wilkinson
000001              Z           Wilkinson
000002              R           Trujillo

I am confused because I am running the same package against the same files but it is just being executed on two different machines and I don't think something like this could be an issue of rights.

Also, my settings for the CSV file are to use a quote as a text qualifier

https://i.stack.imgur.com/oWFKu.jpg

9
  • Are the quotes in the CSV file? Can you post a screenshot of the CSV file?
    – J.S.Orris
    Mar 14, 2014 at 21:10
  • Yes, there are quotes in the CSV file because some of the columns have a comma, so I had to add the quotes. Here is part of the file (it has sensitive data so I can't show it all) - imgur.com/FsUUqZb But every column has quotes EXCEPT the column headers. Could that be my problem?
    – Baub
    Mar 14, 2014 at 21:14
  • And it works they way you want it on another machine?
    – J.S.Orris
    Mar 14, 2014 at 21:15
  • Yes, it works fine on the development machine. Which is why I am now testing it in SQL Server
    – Baub
    Mar 14, 2014 at 21:16
  • Try using Derived Column transformations.
    – J.S.Orris
    Mar 14, 2014 at 21:23

1 Answer 1

0

Right click on your Flat File Source, click Show Advance Editor, click Input and Output Properties, expand Flat File Source Output, expand External Columns, click on each of the columns showing and change the DataType property to Unicode_String for each column, and then do the same for Output Columns. See if this helps.

Following the above process and keeping " (quotes) as your text qualifier, you are going to have to use 2 Derived column transformations and have your Data Flow look like the following screen shot:

enter image description here

In the first Derived Column transformation, input what you see in the screen shot as follows:

enter image description here

In the second Derived Column transformation, input what you see in the screen shot as follows:

enter image description here

Hope this helps.

Note: I used the Excel Destination for testing, per your solution you will want to use either an OLE DB Destination object or OLE DB Command object.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.