A Character String Failed Conversion to a Numeric Value

A Character String Failed Conversion to a Numeric Value

I am just trying to add the letter A to the beginning of the results Im bring back and I keep getting this message. Query Failed. 3535 a character string failed conversion to a numeric value Thanks for any help.

select
            a.area_cd  as CO_Area 
            , 'A' +  a.area_cd
 from intDDt.DIXX a
2

2 Answers

+ is a numeric operator in Standard SQL and Teradata and not a string concat (as in MS SQL Server). You need to use || instead:

'A' || TRIM(a.area_cd)

The TRIM results in an automatic typecast.

1

please try this,

select
         a.area_cd  as CO_Area 
          , ('A' + CAST(a.area_cd AS VARCHAR))
from intDDt.DIXX a
2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Chloe Bennett
Author

Chloe Bennett

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.