December 19, 2011 at 8:39 am
Hello All,
I need to add these numbers
0,-77.21,4
I want the output as -73.21.
When I am using + operator it is just concatenating.
Please assist.
Thanks
December 19, 2011 at 8:51 am
if the datatype is vachar, then it will concatenate instead of addition.
you'll most likely have to explicitly convert to decimal, or money:
select convert(money,'77.41') + convert(money,'4')
if this is a column of data, you should consider fixing the datatypes to be numeric instead of varchars.
Lowell
December 19, 2011 at 8:55 am
Thanks so much. I got it
December 19, 2011 at 8:56 am
December 19, 2011 at 9:46 am
salum (12/19/2011)
it will allow to do the addition if the data type is numeric. if column data type is char it will just contaminate.
Only if the table contains biological wastes. 😛
______________________________________________________________________________
How I want a drink, alcoholic of course, after the heavy lectures involving quantum mechanics.
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply