Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2016-08-05
12
Medium Priority
?
766 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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 4

Expert Comment

by:Daniel Jones
ID: 41745151
0
 

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 2000 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function

876 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