Link to home
Start Free TrialLog in
Avatar of CipherIS
CipherISFlag for United States of America

asked on

SQL Conversion failed when converting the nvarchar value '3.00' to data type int.

Getting error:  Conversion failed when converting the nvarchar value '3.00' to data type int.

on Field LeadTime. I've tried Cast and Convet and both fail.
SELECT MPN, InternalPN, CONVERT(INT, LeadTimeMin) FROM AustinFullExportTemp WHERE MPN = 'xxxxx'

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of irudyk
irudyk
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of CipherIS

ASKER

Thanks!!!
Also, just in case the value in the field is not always numeric text you could use
SELECT MPN, InternalPN, CASE WHEN ISNUMERIC(LeadTimeMin) = 1 THEN CONVERT(INT,CAST(LeadTimeMin AS NUMERIC(10,2))) ELSE 0 END FROM AustinFullExportTemp WHERE MPN = 'xxxxx'

Open in new window