Thiru Thiru - 3 months ago 10
SQL Question

How to solve error converting data type varchar to numeric

SELECT
A.SETMOD, B.DESCRP
FROM
PMS.PSBSTTBL A
JOIN
PMS.PR029TBL B ON A.SETMOD = B.PAYMOD


Paymod
is of datatype
VARCHAR
,
SETMOD
of type
decimal

Answer

Best thing is to convert the decimal to string and compare it with the string value.. make necessary adjustments on the decimal part.. :)

SELECT 
    A.SETMOD, B.DESCRP 
FROM 
    PMS.PSBSTTBL A 
JOIN 
    PMS.PR029TBL B ON CONVERT(VARCHAR(50),A.SETMOD) = B.PAYMOD
Comments