Hi
how to achieve the calculation between two alphanumeric charactered field's value?
we enter only decimal numbers to tht alphanumeric field. but while trying to subtract both the error, 'Invalid operator to alphanumeric value' is thrown
how to calculate? kindly help
New Commer (7/18/2008)
Hihow to achieve the calculation between two alphanumeric charactered field's value?
we enter only decimal numbers to tht alphanumeric field. but while trying to subtract both the error, 'Invalid operator to alphanumeric value' is thrown
how to calculate? kindly help
You can use cast to convert to numeric type.
E.g.
select cast('123' as int) - cast('123' as int)
Regards,
Andras
July 20, 2008 at 11:50 pm
It will be much better to check your alphanumeric values with ISNUMERIC() function before applying mathematical functions.
After that, use CAST for conversion to get the job done.
This way, you will always apply mathematical operation on the numeric values converted from the char / varchar. For incorrect alphanumeric, values, you cag generate message to avoid an error.
Atif Sheikh
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply