Solved

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

Posted on 2016-08-05
12
109 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

828 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