Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Convert Int value to a numeric.

Author  Topic 

kidaduo
Starting Member

45 Posts

Posted - 2008-03-12 : 09:38:08
Hi--

Got a column with int value and I need to sum the entire column by converting to a numeric.-- here what I have

select isnull(convert(varchar(15),sum(cast(columnName as numeric))),'0.00') from myTable-- But my outcome doesnt have decimal 0.00

any help?


Josephine

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-03-12 : 09:42:12
Why you again converting to varchar?

select isnull(sum(cast(columnName as numeric(12,2))),0.00) from myTable


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

kidaduo
Starting Member

45 Posts

Posted - 2008-03-12 : 10:06:35
Thank u Harsh. It works!!

quote:
Originally posted by harsh_athalye

Why you again converting to varchar?

select isnull(sum(cast(columnName as numeric(12,2))),0.00) from myTable


Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"



Josephine
Go to Top of Page
   

- Advertisement -