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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Simple way to format results?

Author  Topic 

KilpAr
Yak Posting Veteran

80 Posts

Posted - 2012-04-23 : 09:38:47
I get results from SUM-function with four decimals. I want them with two decimals. In Excel the solution is for example =TEXT(D1,"0.00"). What's the way to make similar results in T-SQL?

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2012-04-23 : 09:42:20
[code]CAST(SUM(YourCol) AS DECIMAL(19,2))[/code]
Go to Top of Page

KilpAr
Yak Posting Veteran

80 Posts

Posted - 2012-04-23 : 09:45:48
Thanks, I was clearly just missing the first CAST( from there!
Go to Top of Page
   

- Advertisement -