Solved

SQL Server Import/Export Wizard data conversion component

Posted on 2015-01-07
2
2,902 Views
Last Modified: 2015-01-09
Hi all, I have a table in a SQL Server 2008 Database which has a column called AltIndustries in nvarchar(max) format.  I ran into an error while trying to export this table to a tab-delimited text file and receive the error:

"Error 0xc020802e: Data Flow Task 1: The data type for "input column "AltIndustries" (301)" is DT_NTEXT, which is not supported with ANSI files. Use DT_TEXT instead and convert the data to DT_NTEXT using the data conversion component.
 (SQL Server Import and Export Wizard)"

A couple of things:  
The column is the output of a company function that defines its output as nvarchar(max) so that is working as expected.  

Apparently there's a data conversion component to the Import/Export wizard which I'm unaware of.  Does anyone know how I can install this component and use it?

I was able to get around the issue this time by CASTing the output of the function as CHAR(2000) but would like to gain greater understanding about the solution given in the error message.  I expect that I will be running into this again and the output then may be longer.  I'm trying to find a solution where I don't have to test the output length and modify code to insure the cast has enough space.

Comments?

Thanks, Rich
0
Comment
Question by:RichNH
2 Comments
 
LVL 32

Accepted Solution

by:
bhess1 earned 500 total points
ID: 40536556
First - Did you try checking the Unicode box on the Choose a Destination box in the export wizard? That would mean that you are not exporting to an ANSI file, but a Unicode file.

If that doesn't work for you, The simplest way to perform the data conversion is in the source specification.  Instead of just choosing "Copy data from one or more tables or views", choose "Write a query to specify the data to transfer". The create a SELECT statement on the source table, and when you enter the AltIndustries column, put it in a CAST statement - CAST(AltIndustries as varchar(MAX)) as AltIndustries

If for some reason neither of these options work, you might have to create a view on the source with the conversion in the view. However, both of the above options SHOULD work for you.
2
 
LVL 1

Author Closing Comment

by:RichNH
ID: 40541011
The Unicode didn't work but the VARCHAR(MAX) did when I tested it.   Thank you.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

I wrote this interesting script that really help me find jobs or procedures when working in a huge environment. I could I have written it as a Procedure but then I would have to have it on each machine or have a link to a server-related search that …
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Viewers will learn how the fundamental information of how to create a table.

930 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now