I'm having issues with something like this...

Cast(cast(low_value as decimal(8,2)) as varchar) +' - '+ Cast(cast(high_value as decimal(8,2)) as varchar)

Where it seems to work at times but not at others. I get a data type conversion is not possible.

Is there any other way to handle this type of formatting? I tried using the convert function as well but that fails just the same.

1

There are 1 answers

0
theweeknd On

Sry for posting it here and not in comments, but i dont have enough rep to comment. I think you need to use coalesce, that should solve your problem.

Example:

coalesce(low_value,0) now when you get a null value as a low_value, it will take the 0 and not null, so the conversion should not give an error out.