Click here to Skip to main content
15,905,875 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have to field named field1 and field2 and both data type is varchar. How can I get the summation of the two column. Please help me.
Posted
Comments
[no name] 25-Nov-13 1:01am    
Give some example what kind of value you have in there..??
Sumon562 25-Nov-13 1:03am    
I have numeric value

You can have a look at this
sql-server-how-to-sum-a-varchar-column[^]
 
Share this answer
 
You can't unless you make conversion. Note: It's not possible to convert entire data into numeric value. That's why conversion could failed.

Please, see: CAST and CONVERT (T-SQL)[^]

By The Way: If yoou store numeric data as a varchar, it means: bad table design. I would recommend you to re-design your table.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900