Data type conversion trouble

  • I am trying to import some data from a flat file to a table in sql server 2005 database thru a SSIS package.

    When i run the package i get the errors like:

    Error at Extract Employee Data [Sample File Destination [178]]: Column "Addr1" cannot convert between unicode and non-unicode string data types.

    Error at Extract Employee Data [Sample File Destination [178]]: Column "Addr2" cannot convert between unicode and non-unicode string data types.

    Error at Extract Employee Data [Sample File Destination [178]]: Column "AddrCity" cannot convert between unicode and non-unicode string data types.

    Error at Extract Employee Data [Sample File Destination [178]]: Column "AddrState" cannot convert between unicode and non-unicode string data types.

    I have used 'suggest types' in the flat file connection manager which has given many columns as string [DT_STR].

    I have tried different datatypes in the destination table like ntext, nchar, nvarchar(max) but nothing is working. Can some one suggest me the compatible datatype in the destination table or some other way/workaround to resolve the issue.

    thanks

    Pankaj

  • try out varchar

  • Can you give us the DDL (create table script) of the table in SQL Server 2005 ?

    We need the type of the field in your table to help you.

  • Hi There

    Seen this one a few times

    You need to go into the Advanced portion of the Flat File connection Manager and define the columns as Unicode string [DT_WSTR] as your table columns are probably defined as nchar or nvarchar.

    The other option is to include a data conversion task to convert your columns from string [DT_STR] to unicode string [DT_WSTR]

    or even simpler (if you can do it) is to change your table columns from nchar/nvarchar to char/varchar.

    enjoy 🙂

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply