I have a column that is varchar(80) and is storing dollar amounts (no $ sign). I would like to update the value by adding another amount, e.g. the existing amount is 96.73 and I want to add 1.00 to make 97.73.
I have tried cast and convert without any luck. I have tried:
set CAVALUETEXT = convert(INT, CAVALUETEXT) + 1.00
set CAVALUETEXT = cast(cavaluetext as int) + 1.00
and get the same error:
Conversion failed when converting the varchar value '96.73' to data type int.
I think I am using SQL Server 2008.
You can use
CONVERT(float, [YOUR Varchar]). For exampleCONVERT(float, '0.123')convert it to a float0.123. This only works on SQL Server.