Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2016-08-05
12
Medium Priority
?
515 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

 

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

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

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

A couple of weeks ago, my client requested me to implement a SSIS package that allows them to download their files from a FTP server and archives them. Microsoft SSIS is the powerful tool which allows us to proceed multiple files at same time even w…
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

721 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