Solved

No match in target code page Error. (when inserting into SQL table)

Posted on 2016-08-05
12
65 Views
Last Modified: 2016-08-08
Hi, I'm really hoping that someone can offer some help on this as I this issue is becoming increasingly problematic.

I've created a pretty simple SSIS package that does the following:

1. Uploads a test.csv file to a temp SQL table. (The csv contains text in lots of different languages).
2. Copies the data from the temp table to another table.

Thats pretty much it.

The problem I am having is happening at step 1 (when the csv file is being uploaded).

The errors that I get are all centered around the "Code Page".


"Description: Data conversion failed. The data conversion for column "Column 27" returned status value 4 and status text "Text was truncated or one or more characters had no match in the target code page.".
 

Full error:

ssisError.PNG

Now where the error is actually happening.

ssisCodePage.PNG

Conclusion:

I think this is happening because of the muliple languages contained in the CSV but I cannot seem to find the correct code page to use in order to 'CATCH ALL'.

My SQL table fields are all set to varchar(max) so its not a question of length.

Really hoping that someone can help.

I can provide further information is required.

Thanks
0
Comment
Question by:SmashAndGrab
  • 6
  • 5
12 Comments
 
LVL 25

Expert Comment

by:Lee Savidge
ID: 41743782
Set the SQL fields data typeto nvarchar(max). With different languages and character sets you will need unicode compliant datatypes
0
 

Author Comment

by:SmashAndGrab
ID: 41743804
Hi Lee,

Thanks.

Just noticed my previous comment:  
My SQL table fields are all set to varchar(max) so its not a question of length.

This was a bit of a red herring as the error is gerenerated when the temporary table is created and this is generated on the fly.

ssisErro3.PNG
Source File..

ssiserr4.PNG
0
 
LVL 25

Expert Comment

by:Lee Savidge
ID: 41743978
When you set the data type in the wizard, use DT_WSTR instead of the DT_STR as the former is unicode.
0
 

Author Comment

by:SmashAndGrab
ID: 41743987
Can I change it retrospectivley?
0
 
LVL 25

Expert Comment

by:Lee Savidge
ID: 41743991
Yes, you should be able to edit the job again with the wizard and save it. If you save the package to the file system instead of storing in the database, you can manually edit it using the import/export wizard.

On a side note, when editing DTS jobs stored in the filtesystem, despite many server environments being 64bit these days, I still have moree success editing them and getting them to work when running in the 32 bit variety of the import/export application.
0
 
LVL 3

Expert Comment

by:Daniel Jones
ID: 41745151
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:SmashAndGrab
ID: 41746838
Hi Lee,
I think we might be a step closer!

I have changed all the references from "string [DT_STR]" to "Unicode string [DT_WSTR]" as you suggested.

I'm getting a different error.

Here are some screenshots..
ssis5.PNG
ssis6--2-.PNG
ssis7.PNG
ssis8.PNG
0
 

Author Comment

by:SmashAndGrab
ID: 41746996
Hi,

I have been tinkering again.

I created a new package from scratch as you suggested using the import/export wizard as this is a very simple package in what it does.

1.  For the import of the CSV file to the TEMP sql table I used the UNICODE datatype that you suggested..

Is ask's here to select the code page type..  I am leaving it as default as I dont know if it should be something else?
ssis_New_Import.PNG
Next:

ssis_PreviewChangetoUni.PNG
Preview:

ssis_PreviewLooksGoog.PNG

Re-run NEW error:

ssis_error.PNG
Could this be a problem with the code page type when the CSV file is being produced?  Should it be something else perhaps?
0
 
LVL 25

Accepted Solution

by:
Lee Savidge earned 500 total points
ID: 41747001
That error says data was truncated. Basically the target field doesn't seem to be large enough to take the data in column 4. It might be that some data is too long? If they're nvarchar(max) fields though, that shouldn't be a problem.

You could create the SQL table yourself in the database and then just import into it. Then as part of the DTS job, truncate the table when done if you intend to reuse it.
0
 

Author Comment

by:SmashAndGrab
ID: 41747004
Code Page type from a text editor.
0
 

Author Comment

by:SmashAndGrab
ID: 41747321
Hi Lee,

Thanks.  Your answer gave me the solution.

You could create the SQL table yourself in the database and then just import into it. Then as part of the DTS job, truncate the table when done if you intend to reuse it.

Thanks very much my friend.  I think you may have stopped my hair from falling out!
0
 
LVL 25

Expert Comment

by:Lee Savidge
ID: 41747332
Glad to be of help. Often another set of eyes can help lead you to the solution via another path.

:)
1

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now