Re: converting data to null using DBNull problem

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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 ?


.



Relevant Pages

  • Help!! Oracle 9.2.0.5.0 wont properly read the *.rsp
    ... #Datatype: String ... #Datatype: Boolean ... #This page shows the current status in the installation. ...
    (comp.databases.oracle.server)
  • Re: GOSUB, the larger picture (was Worldwide known Excellence of GOSUB)
    ... > does not mean that was not a hack. ... Yep, a Byte datatype was indeed needed, and welcome! ... No need to break String, ... It aint bigger Karl, ...
    (microsoft.public.vb.general.discussion)
  • Re: Access Query Right Align
    ... Gary - The DataType is text for all fields. ... Dim hFile As Long ... Dim strPath As String ... Dim strTextLine As String ...
    (microsoft.public.access.queries)
  • Re: Get Data Type
    ... the data types of the resultant columns - similiar to the decisions made by ... If I then needed to find out what datatype these variables were I could use: ... wanted to know if a string represented a positive long integer then I would ...
    (microsoft.public.access.modulesdaovba)