NULL(DT_CY) Error Convert string to money
Hi,
I'm trying to convert a column from a flat file to money.
So i put into the derived column following expression
LTRIM(RTRIM(TktAmount)) == "" ? NULL(DT_CY) : (DT_CY)TktAmount
But still when i have empty TktAmounts, which contain "", I get an error on the OLEDB Destination at the ticketamount column with a datatype 'money'. Errorcode :
0x80004005. Did anybode have the same error or knows what the problem is?
Thanks a lot!
Alina
July 2nd, 2011 11:53am
If the data type of incoming column TktAmount is string
you can try length function
len(ltrim(rtrim(TktAmount)))==0?NULL(DT_CY) : (DT_CY)TktAmount
latha
Free Windows Admin Tool Kit Click here and download it now
July 2nd, 2011 1:23pm
What happens if you get a value of "ONE DOLLAR" in that field? The length WON'T be zero so it will try to convert TktAmount to currency but will fail.
Another option is to have a Data Conversion transform that handles this one conversion, then REDIRECT the Error Rows to a Derived Column that assigns a value of
NULL(DT_CY) and UNION the error flow back in with the regular flow (those rows where the conversion when OK)
Todd C - MSCTS SQL Server 2005 - Please mark posts as answered where appropriate.
July 2nd, 2011 4:40pm