Avatar of SmashAndGrab
SmashAndGrab
 asked on

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

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
Microsoft SQL Server 2008Microsoft SQL ServerMicrosoft SQL Server 2005SSIS

Avatar of undefined
Last Comment
Lee

8/22/2022 - Mon
Lee

Set the SQL fields data typeto nvarchar(max). With different languages and character sets you will need unicode compliant datatypes
SmashAndGrab

ASKER
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
Lee

When you set the data type in the wizard, use DT_WSTR instead of the DT_STR as the former is unicode.
Your help has saved me hundreds of hours of internet surfing.
fblack61
SmashAndGrab

ASKER
Can I change it retrospectivley?
Lee

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.
Daniel Jones

⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
SmashAndGrab

ASKER
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
SmashAndGrab

ASKER
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?
ASKER CERTIFIED SOLUTION
Lee

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SmashAndGrab

ASKER
Code Page type from a text editor.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
SmashAndGrab

ASKER
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!
Lee

Glad to be of help. Often another set of eyes can help lead you to the solution via another path.

:)