Cast Problem with numeric

Hi

Select cast( <fieldname> as sql_char) from… returns NULL

when fieldname is of type numeric.

Regards

Marcus

Hi Select cast( <fieldname> as sql_char) from... returns NULL when fieldname is of type numeric. Regards Marcus

Cast Problem with numeric

Very Helpfull

User Rating: Be the first one !
Vice Professor Asked on May 24, 2017 in SAP PORTAL.
Add Comment
2 Answer(s)

    To recreate:

    create table test ( number numeric(2,0) ); insert into test values (0); insert into test values (1); insert into test values (2); insert into test values (3); select number, cast (number as sql_char ) from test;

    Add Comment

      Details? I did a few tests and everything works as expected. Maybe “fieldname” is already NULL? Have you checked CAST(IFNULL(fieldname, 0.0) as SQL_CHAR) or the like?

      Add Comment

      Your Answer

      By posting your answer, you agree to the privacy policy and terms of service.