SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Simple way to format results?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

KilpAr
Yak Posting Veteran

80 Posts

Posted - 04/23/2012 :  09:38:47  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

5152 Posts

Posted - 04/23/2012 :  09:42:20  Show Profile  Reply with Quote
CAST(SUM(YourCol) AS DECIMAL(19,2))
Go to Top of Page

KilpAr
Yak Posting Veteran

80 Posts

Posted - 04/23/2012 :  09:45:48  Show Profile  Reply with Quote
Thanks, I was clearly just missing the first CAST( from there!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000