Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

T-SQL help require to construct a query to sum on varchar column

$
0
0

Guys,
I have a column varchar(400) wherein currency_amount is stored. I need to sum currencyamount however getting the error like  Arithmetic overflow error converting varchar to data type numeric.

Any suggestion? it has some values  which are having 37 digits after decimal. Might be this is the possible reason.

Few Ex. .240189558129349189976534590012169112856, .312064488126471335301440042584800148951

This is the query i am trying
select sum(convert(decimal(38,20),columnname))
FROM tablename 


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>