﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8)  / How to convert to two decimal places / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 19 Jun 2013 00:57:03 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: How to convert to two decimal places</title><link>http://www.sqlservercentral.com/Forums/Topic1381020-392-1.aspx</link><description>Use STR function. E.g:[code="sql"]declare @x money=12345.69851SELECT [STR]=STR(@x, 20, 2), [CONVERT_default]=CONVERT(varchar(20), @x), [CONVERT_format_1]=CONVERT(varchar(20), @x, 1), [CONVERT_format_2]=CONVERT(varchar(20), @x, 2)[/code]</description><pubDate>Mon, 05 Nov 2012 18:09:10 GMT</pubDate><dc:creator>Vedran Kesegic</dc:creator></item><item><title>RE: How to convert to two decimal places</title><link>http://www.sqlservercentral.com/Forums/Topic1381020-392-1.aspx</link><description>cast the inner sum as decimal then case the whole output as varchar</description><pubDate>Mon, 05 Nov 2012 05:53:22 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>RE: How to convert to two decimal places</title><link>http://www.sqlservercentral.com/Forums/Topic1381020-392-1.aspx</link><description>My charge amount need to cater for both "Then" and "Else", my "else" returns string hence I cast it as varchar. that code so far is working but I need to return two decimal value amount.</description><pubDate>Mon, 05 Nov 2012 05:51:59 GMT</pubDate><dc:creator>hoseam</dc:creator></item><item><title>RE: How to convert to two decimal places</title><link>http://www.sqlservercentral.com/Forums/Topic1381020-392-1.aspx</link><description>is your chargeAmount  is INT then you need to convert it to decimal to get decimal in SUM</description><pubDate>Mon, 05 Nov 2012 05:36:19 GMT</pubDate><dc:creator>BriPan</dc:creator></item><item><title>RE: How to convert to two decimal places</title><link>http://www.sqlservercentral.com/Forums/Topic1381020-392-1.aspx</link><description>You will need to convert it to a data type which allows you to specify the amount of decimal places you want, you would want decimal with the correct precision to cope with how ever many decimal places you need.</description><pubDate>Mon, 05 Nov 2012 05:32:59 GMT</pubDate><dc:creator>anthony.green</dc:creator></item><item><title>How to convert to two decimal places</title><link>http://www.sqlservercentral.com/Forums/Topic1381020-392-1.aspx</link><description>HiI have this code herecase      when chargeType &amp;lt;&amp;gt; 'ADV_SWITCH_FEE'      then CAST(isNull(sum(chargeAmount)/100.0, 0.0) AS VARCHAR)   else '' end as chargeAmountHow do I convert my "sum" into decimal places?</description><pubDate>Mon, 05 Nov 2012 05:31:07 GMT</pubDate><dc:creator>hoseam</dc:creator></item></channel></rss>