Re: converting data to null using DBNull problem
- From: PRW <PRW@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 20 Dec 2006 03:19:00 -0800
1. Unfortunately, the DBNull Object can only be set to a String type so
setting the datatype here to other than string type would cause an error.
It is possible to set the datatype here though and use thte Parse function
on the DBNull object to set to numeric, but this still causes the same
failure.
2. This option is already set.
"Allan Mitchell" wrote:
Have you tried.
1. On the Flat File Connection Manager go to the Advanced tab have a
look at the "Suggest Types" button. Hopefully this will change the
default of String 50 to a proper Integer datatype
2. On the Flat File source Adapter check the box on the front screen
that says "Retain null values from the source as null values in the data
flow."
That should allow you to put in the right datatype and also retin nulls.
--
Regards
Allan Mitchell
Konesans Ltd
T +44 7966 476 572
F +44 2071 008 479
http://www.konesans.com
"PRW" <PRW@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:54F30B0B-3E30-46F9-BFBA-28504B5806D2@xxxxxxxxxxxxx:
I have a flat file source that in some string data rows contains all
blank
spaces.
The original data is actually numeric, so I want to convert this to
numeric
data with null values where the field exists as empty spaces.
In a ST task I can successfully do this using the DBNull function (check
by
copying the data out of Data Viewer and I believe it is now null)
Row.ST1parntiorgid = Convert.DBNull.ToString,
but, then when I move to the next task to convert the data using Data
Conversion task, from string to numeric it fails with
'.........truncation
would cause data to be lost'.
If in the ST task I convert fields with empty spaces to "0" and then
convert
to numeric it works successfully, so somehow there is an issue with
converting to null.
I tested that a DC task can convert a string datatype to numeric with
null
value in it and this works OK as expected, so I feel somehow the DBNull
function isin't actually creating a null in the fields correctly.
Any ideas anyone ?
- References:
- Re: converting data to null using DBNull problem
- From: Allan Mitchell
- Re: converting data to null using DBNull problem
- Prev by Date: DTS Conversion error because of empty row
- Next by Date: Multiple Workflow execution of Tasks
- Previous by thread: Re: converting data to null using DBNull problem
- Next by thread: Re: SSIS: Oracle to SQL Server transformation
- Index(es):
Relevant Pages
|