Convert varchar to int

  • I have this CASE WHEN weight < 1 THEN 'UPS' ELSE CASE WHEN weight BETWEEN 1.00 AND 2 THEN 'UPS2' ELSE weight END END I get an error message that I need to convert from varchar to int. How can I do it?Thank you

  • I think this should work...

    CASE WHEN weight < 1 THEN 'UPS'

    WHEN weight BETWEEN 1.00 AND 2 THEN 'UPS2'

    ELSE CAST(weight AS VARCHAR(50))

    END

  • Thank you

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply