all groups > sql server dts > april 2004 >
You're in the

sql server dts

group:

Loading nullable data from fixed-width flat file


Loading nullable data from fixed-width flat file no5pam NO[at]SPAM hotmail.com
4/27/2004 3:26:21 PM
sql server dts:
I am getting the following error when attempting to CopyColumn between
a fixed-width flat file and a nullable decimal column:

"Error Source : Microsoft Data Transformation Services (DTS) Data Pump

Error Description : The number of failing rows exceeds the maximum
specified.
TransformCopy 'DTSTransformation__13' conversion error: General
conversion failure on column pair 1 (source column 'Q_LVS_MLE'
(DBTYPE_STR), destination column 'Q_LVS_MLE' (DBTYPE_NUMERIC))."

Generally speaking, is it possible to load nullable data from a
fixed-width flat file in which a "null" column value is populated with
spaces?

I've tried using all of the TransformFlag settings that might apply
(DTSTransformFlag_AllowDemotion,
DTSTransformFlag_AllowLosslessConversion,
DTSTransformFlag_AllowNullChange,
DTSTransformFlag_AllowNumericTruncation,
Re: Loading nullable data from fixed-width flat file Allan Mitchell
4/28/2004 5:52:04 AM
Spaces are not nulls they are empty strings

i.e.

declare @i numeric(10,2)
declare @s varchar(2)

set @s = ' '

--set @i = @s

/*
Server: Msg 8114, Level 16, State 5, Line 6
Error converting data type varchar to numeric.
*/

--set @i = CAST(@s as numeric(10,2))

/*
Server: Msg 8114, Level 16, State 5, Line 13
Error converting data type varchar to numeric.
*/

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


[quoted text, click to view]

Re: Loading nullable data from fixed-width flat file Isak Dinesen
4/28/2004 10:14:42 AM
So it is simply not possible to load a table containing nullable columns
from a fixed-width text file without setting up a custom ActiveX transform
on every nullable column? I was hoping it would be possible to configure the
task with a specific null escape sequence (\0, for example), that would be
interpreted as null by the CopyColumn transform.

[quoted text, click to view]

Re: Loading nullable data from fixed-width flat file Allan Mitchell
4/29/2004 7:39:05 AM
According to the text file driver docs

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcjettext_file_format.asp

NULL in fixed width is represented by blanks.

I just tested this and that does not seem to hold true. So in the absence
of knowing how to do this any other way I would do this

We know that the amount of blanks has to be equal to the length of the field
in the text file right?

Insert the whole text file into a staging table and use ISNULL() from there
to decide whether the value should be null.

--
--

Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP)
www.SQLDTS.com - The site for all your DTS needs.
I support PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org


[quoted text, click to view]

Re: Loading nullable data from fixed-width flat file Isak Dinesen
4/29/2004 9:18:02 PM
Thanks Allan. Another possibility that occurred to me was to extend the
default DTS CopyColumn transformation with an option to allow the user to
specify a null character sequence. My only problem here is the ATL example
that ships with SQL 2k was written for VC6. I'm running VS 2003, and haven't
been able to find an updated SQL Server CustomTransform ATL example, and
lack the experience with ATL to know how to update the example myself.


[quoted text, click to view]

AddThis Social Bookmark Button