30.1.16

Column Cannot Convert Between Unicode and Non-Unicode String Data Types

Considering a string column import, assume that you have the following data in your excel file:

Games


Cricket

Tennis
Badminton
Foot Ball
Hockey
Volley Ball

And your SQL Table template is as such:


CREATE TABLE [dbo].[tblGames](

[Games] [varchar](50) NULL
) ON [PRIMARY]

GO


When you try to import using SSIS the following error raises as follows:


Column "Games" Cannot Convert Between Unicode and Non-Unicode String Data Types


This occurs because SQL default type for string column is varchar, which is of type non-unicode. But Excel data is unicode. Hence the column type needs to be updated as nvarchar with a length of 255, as a warning may arise saying "Truncation may occur due to inserting data from data flow task".


Finally the table structure is 



This solves both the error and warning and provides a successful output.


Cheers,
Venkatesan Prabu .J
Managing Director – KaaShiv Info Tech / MSP-MVP Mentor
www.kaashivinfotech.com


No comments:

Post a Comment