Page 1 of 1

ODBC Sql Server Error

Posted: Wed May 16, 2018 9:52 am
by anto.vis
Hi all,
I have a problem when I try to write into a Sql Server Db (from db2), and the datatype of target column is "money".

the log show this errror: ODBC function "SQLExecute" reported: SQLSTATE = 22018: Native Error Code = 0: Msg = [IBM(DataDirect OEM)][ODBC SQL Server Legacy Driver]Invalid character value for cast specification (CC_OdbcDBStatement::executeInsert, file CC_OdbcDBStatement.cpp, line 731)

I tried also this: change (column_name,",",".") but in this case the job write always 0 (0,00).

My ODBC properties:
Array size: 1
Fail on size mismatch: No
Fail on type mismatch: No
Drop unmatched fields: No
Code page: Default
Fail on row error: Yes

Have you any suggestion?

Thanks and regards.
Antonio

Posted: Sat May 19, 2018 8:03 pm
by ray.wurlod
SQL Server's "money" (CURRENCY) data type is Decimal(19.4)

The reason for this, so I believe, is that Microsoft had planned to take over all world currencies and replace them with one called the Bill. Each of these would be worth so much that four decimal places are needed for sensible amounts, such as the cost of a cup of coffee (0.0002 Bills).
:lol:

Posted: Sun May 20, 2018 7:53 am
by chulett
Ladies and Gentlemen, Ray Wurlod!
<smattering of applause>

Antonio,

What is your source datatype? Are you doing the CAST (custom insert SQL) or is that happening automatically? I for one would also like to see some of the source values, see what the data looks like that you are trying to put into this MONEY field.