Sunday, February 19, 2012

Cannot set numeric to null before inserting to table

Hi,

I have a flat file whose data looks like this:

"Opening Balance", Acct1234, 1001.01

"Closing Balance", Acct1234, 1001.01

In my script component for "Opening Balance", I set my output columns like this:

Row.AccountNumber = CDate(rowValues(1)

Row.OpeningBalance = CDec(rowValues(2))

Row.ClosingBalance = Nothing

Because I don't have a value for ClosingBalance in this row, I set ClosingBalance = Nothing.

And for "Closing Balance", I set my output columns like this, because there's no value for OpeningBalance.

Row.AccountNumber = CDate(rowValues(1)

Row.OpeningBalance = Nothing

Row.ClosingBalance = Nothing

Then, in my column mappings I map OpeningBalance = OpeningBalance and ClosingBalance = ClosingBalance.

The idea being that if there's no value, then it should be set to NULL. However, in my table, I see that instead of NULLs, there's 0.00000. Which is not what I want to see.

Any ideas why this is happening?

Thanks

Oops, I meant:

And for "Closing Balance", I set my output columns like this, because there's no value for OpeningBalance.

Row.AccountNumber = CDate(rowValues(1)

Row.ClosingBalance = CDec(rowValues(2)

Row.OpeningBalance = Nothing

|||

After sniffing around a little bit, it seems that one can't set anything but a String to Nothing, ie) NULL?

Is this true? Seems to be the case here anyways. When I set my empty values to -999 they show up beautifully in the table, so it's definitely ignoring my request to set to NULL.

Is there a way to force this to work?

|||Try Row.ClosingBalance_IsNull = True.|||Duh, forgot about that!

No comments:

Post a Comment