Trying to export a table to a flat file by using Tasks / Export Data menu.
I am trying to export to ANSI 1252 Code Page.
My table has some nvarchar
columns in it.
I am getting the message:
The data type 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.
I have tried changing the source column mappings in the Columns Mapping section from Unicode string DT_WSTR
to just string DT_STR
, it didn't work.
Is it possible to export to ANSI file without altering my table? Is there an easier way? I couldn't find a way to change the source columns to regular varchar
string.
Columns[Value]" 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.
Since the column is a VARCHAR(MAX) data type in SQL Server, SSIS treats this as a DT_TEXT datatype. The DT_TEXT and DT_NTEXT are text data types and there are several limitations related to handling these datatypes in SSIS. For example, none of the string functions would work with these data types.
STEP 1: Drag and drop the data flow task from the toolbox to control flow and rename it. Double click on it, and it will open the data flow tab. Next, drag and drop EXCEL Source and SSIS Data Conversion Transformation from the toolbox to the data flow region. Please refer to CAST and CONVERT in SQL Server.
For anyone looking for an alternative solution;
This solved the above problem for me.
You will have to use the Data Conversion Component to convert the data if you cannot change your source columns.
Changing the source columns that is the easiest but not always an option. For example, I am returning a delimited list using XML FOR PATH
and since I am doing this in a stored procedure, all I needed to do was convert the column to varchar(max)
and the error went away and SSIS was happy.
select distinct
[WhatIfId],
cast(stuff
(
(
select
'; ' + plr.[Label]
from [dbo].[track_rate_override_reasons_instance] tor
join [dbo].[PickList_Loans_WhatIf_Rate_OverrideTypes] plt
on plt.[OverrideTypeId] = tor.[OverrideTypeId]
join [dbo].[PickList_Loans_WhatIf_Rate_OverrideReasons] plr
on plr.[ReasonId] = tor.[ReasonId]
FOR XML PATH ('')
)
, 1, 1, '') as varchar(max)) AS 'OverrideReasons'
from [dbo].[track_rate_override_reasons_instance]
Is it possible for you to wrap your source within a stored procedure so that you can manipulate the conversion?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With