Can't convert DT_NTEXT to NUMCERIC using SSIS - sql

we load a CSV from the web via Power Query. Among other columns there are three money columns with the data type DT_NTEXT as output column. I have already tried to use a data conversion task as first thing to convert the columns to DT_WSTR(4000) and then convert them to numeric(17,5) in a following Derived Column Task with the following expression:
TRIM(price_conv) == "" ? NULL(DT_NUMERIC,17,5) : ((DT_NUMERIC,17,5)TRIM(price_conv))
Unfortunately, this still fails.
Error messages:
[Derived column [2]] Error: SSIS Error Code DTS_E_INDUCEDTRANSFORMFAILUREONERROR. The "Derived column" failed because error code 0xC0049063 occurred, and the error row disposition on "Derived column.Output[Output of the Derived column].column[price_derived]" specifies failure on error. An error occurred on the specified object of the specified component. There may be error messages posted before this with more information about the failure.
[SSIS.Pipeline] Error: SSIS Error Code DTS_E_PROCESSINPUTFAILED. The ProcessInput method on component "erived column" (2) failed with error code 0xC0209029 while processing input "Inputof the derived column" (3). The identified component returned an error from the ProcessInput method. The error is specific to the component, but the error is fatal and will cause the Data Flow task to stop running. There may be error messages posted before this with more information about the failure.
PS: Error messages partly translated from German.
I also tried to set DT_WSTR in the advanced editor of the Power Query source, but it failed as well.
Does anyone have an idea?

I had to use the replace function for the separator (. and ,), then it worked.
#1 Convert to DT_WSTR using the data conversion task or in the derived column task
#2 Pay attention to the separator and replace with the replace function if necessary
Example:
TRIM(origprice_conv) == "" ? NULL(DT_NUMERIC,17,5) : ((DT_NUMERIC,17,5)REPLACE(TRIM(origprice_conv),".",","))
origprice_conv is already converted to DT_WSTR.
It's a pity that SSIS does not give a meaningful error message here.
My problem was two fold but the Data Viewer helped identify the problems. The first was that I could have blank values for origprice_conv and the default conversion did not work. I solved this by casting a null to the correct DT_NUMERIC specification. The second problem was that the source data used US style decimal places in the data. Being in Germany, the conversion expected the string to be "123,45" instead of "123.45". Internationalization note, the period is the thousands separator for Germany.

The problem is that there is not implicit or explicit conversion from ntext to numeric, reference: https://learn.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql?view=sql-server-ver15
The trim will fail in the first place so what you may need to do, as suggested by billinkc, is a double conversion, to wstr, trim, and then to numeric :
(DT_NUMERIC,17,5)TRIM((DT_WSTR,20)(price_conv))

Related

**** 04:04:32 TPT10508: RDBMS error 3857: Cannot use value (or macro parameter) to match '<column_name>'

**** 04:04:32 TPT10508: RDBMS error 3857: Cannot use value (or macro parameter) to match '<column_name>'.
facing this issues while
executing tpt to load data from csv to Teradata DB. Could you please
help me in resolving this issue.
simple cast logic is used to convert data type from Varchar to decimal and timestamp(0).
and if i hardcode the value like (cast(20.0) as decimal(12,2) ) its working fine.
Failure case cast(column_nm) as decimal(12,2) .

Firebird ISC 335544334 - Conversion error from string "2002-07-07 22:00:00.000"

I am currently working on a project which allows you to import data from an Excel file. I use the Programm RazorSQL. But every time I start the import, the
ISC error code 335544334 occures ->
An error occurred: java.sql.SQLException: conversion error from
string "2002-07-07 22:00:00.000" [SQLState:22018, ISC error
code:335544334]
Does Firebird use some special Date formats? I really need an answer, it's very important. This problem keeps me waiting to continue with my work...
The error message indicates that Firebird tried to convert the string value 2002-07-07 22:00:00.000 to a datatype other than CHAR/VARCHAR and did not succeed because the string value is invalid for the target datatype. The format as shown will correctly convert to a TIMESTAMP, which means that you are assigning this either to the wrong column, or the column has the wrong type. For example, a DATE has no time component in dialect 3, so converting a string with a time component will fail with this error, as will converting to a numerical column (INTEGER, BIGINT, etc).
Without more information about the columns involved and the exact method of import, it is not possible to provide a more specific answer.

Assigning an integer value to an output row, pentaho

I'm using kettle in a very basic way. What I want to do is read from csv file, do some kind of transformation in User Defined Java Class step and write output to a text file.
a picture http://imageshack.com/a/img34/1669/vo18.png
When I run this I essentially get this error:
value Integer<binary-string> : There was a data type error: the data type of java.lang.Long object [100] does not correspond to value meta [Integer<binary-string>]
This is the line in UDJC step that seems to make the problem (field "value" is of Integer type):
get(Fields.Out, "value").setValue(out_row,new Long(100));
How can I solve this?
So the answer is: Turn lazy conversion off.

OSStatus NSOSStatusErrorDomain

I received the following error when I get the property using
AudioSessionGetProperty(kAudioSessionProperty_CurrentHardwareSampleRate,&size,
&myAudioDescription.mSampleRate)
Error Produced by above statement is
Error Domain=NSOSStatusErrorDomain Code=560557673 "The operation couldn’t be completed. (OSStatus error 560557673.)"
Now, here what does 560557673 mean and where can I find its explanation?
Documentation only provides NSOSStatusErrorDomain as one of the errors.
That code means the property data size was not correct.
OSStatus is a type commonly used for error codes in OS X and iOS. If the magnitude of the code is less than 1 million, then the code is probably listed in MacErrors.h in the CarbonCore framework. Otherwise, it is probably a four-character code listed in the same header as the function which returned it. You can find the header of a function by command-clicking it in Xcode. The codes will most likely be listed near the top, grouped together. To convert the number to a code, use the Calculator app in Developer view to convert it to hexadecimal and convert each byte to a character.

Arithmetic operation resulted in an overflow

When i send:
Result = CInt(NetApiBufferFree(pBuffer))
I receive (SOME TIMES) this error:
Arithmetic operation resulted in an overflow.
What exactly means that? and how i can resolve it?
It means that CInt argument is out of range of Integer, -0x80000000 to 0x7FFFFFFF
And it happens when NetApiBufferFree returns an error: error codes are bigger than 0x80000000.
There is no unsigned int32 type, so use CLng instead of CInt.
About source of error. You should find out code of error which you get: call MsgBox or log it to file, or use breakpoint. Next find its description. If it won't help you (for example error would be E_FAIL), add code to check that pBuffer value is valid - that it wasn't modified by something, and wasn't already freed. Add logging for NetApiBuffer* calls.
Best answer is replace 'double' in place of 'Int16/Int32/Int64'
some times file conversion takes huge numbers.. double never has maximum range.