<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; Puzzle &#8211; Challenge &#8211; Error While Converting Money to Decimal</title>
	<atom:link href="http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/</link>
	<description>SQL, SQL Server, MySQL, Big Data and NoSQL</description>
	<lastBuildDate>Wed, 19 Jun 2013 05:09:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Juan</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-475117</link>
		<dc:creator><![CDATA[Juan]]></dc:creator>
		<pubDate>Tue, 14 May 2013 13:34:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-475117</guid>
		<description><![CDATA[Buena respuesta, me sirvio]]></description>
		<content:encoded><![CDATA[<p>Buena respuesta, me sirvio</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: VINAY</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-390689</link>
		<dc:creator><![CDATA[VINAY]]></dc:creator>
		<pubDate>Mon, 10 Dec 2012 12:28:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-390689</guid>
		<description><![CDATA[Numeric data types that have fixed precision and scale. 
decimal[ (p[ , s] )] and numeric[ (p[ , s] )] 

p (precision)  :
The maximum total number of decimal digits that can be stored, both to the left and to the right of the decimal point.
s (scale)  :
The maximum number of decimal digits that can be stored to the right of the decimal point.]]></description>
		<content:encoded><![CDATA[<p>Numeric data types that have fixed precision and scale.<br />
decimal[ (p[ , s] )] and numeric[ (p[ , s] )] </p>
<p>p (precision)  :<br />
The maximum total number of decimal digits that can be stored, both to the left and to the right of the decimal point.<br />
s (scale)  :<br />
The maximum number of decimal digits that can be stored to the right of the decimal point.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #006 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-389246</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #006 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 08 Dec 2012 01:31:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-389246</guid>
		<description><![CDATA[[...] SQL SERVER – Puzzle – Challenge – Error While Converting Money to Decimal (Solution)  [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL SERVER – Puzzle – Challenge – Error While Converting Money to Decimal (Solution)  [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Soumya Sunu</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-388831</link>
		<dc:creator><![CDATA[Soumya Sunu]]></dc:creator>
		<pubDate>Fri, 07 Dec 2012 12:21:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-388831</guid>
		<description><![CDATA[Exactly, first digit shows the total length]]></description>
		<content:encoded><![CDATA[<p>Exactly, first digit shows the total length</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #005 &#171; SQL Server Journey with SQL Authority</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-384386</link>
		<dc:creator><![CDATA[SQL SERVER &#8211; Weekly Series &#8211; Memory Lane &#8211; #005 &#171; SQL Server Journey with SQL Authority]]></dc:creator>
		<pubDate>Sat, 01 Dec 2012 01:31:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-384386</guid>
		<description><![CDATA[[...] SQL SERVER – Puzzle – Challenge – Error While Converting Money to Decimal [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL SERVER – Puzzle – Challenge – Error While Converting Money to Decimal [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: fbncs</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-103867</link>
		<dc:creator><![CDATA[fbncs]]></dc:creator>
		<pubDate>Sun, 05 Dec 2010 18:16:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-103867</guid>
		<description><![CDATA[shure, but don&#039;t forget... if you have 4 decimals in @mymoney, you&#039;ll lost information doing this convertion. The most correclty to do in that case is DECIMAL(9,4).]]></description>
		<content:encoded><![CDATA[<p>shure, but don&#8217;t forget&#8230; if you have 4 decimals in @mymoney, you&#8217;ll lost information doing this convertion. The most correclty to do in that case is DECIMAL(9,4).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQLAuthority News – Statistics Used by the Query Optimizer in Microsoft SQL Server 2008 – Microsoft Whitepaper Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-103668</link>
		<dc:creator><![CDATA[SQLAuthority News – Statistics Used by the Query Optimizer in Microsoft SQL Server 2008 – Microsoft Whitepaper Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Sat, 04 Dec 2010 01:31:08 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-103668</guid>
		<description><![CDATA[[...] very first answer was provided by Fbncs and Dheeraj had very interesting [...]]]></description>
		<content:encoded><![CDATA[<p>[...] very first answer was provided by Fbncs and Dheeraj had very interesting [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQLAuthority News – Statistics Used by the Query Optimizer in Microsoft SQL Server 2008 – Microsoft Whitepaper Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-103666</link>
		<dc:creator><![CDATA[SQLAuthority News – Statistics Used by the Query Optimizer in Microsoft SQL Server 2008 – Microsoft Whitepaper Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Sat, 04 Dec 2010 01:31:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-103666</guid>
		<description><![CDATA[[...] The puzzle was posted here:  SQL SERVER – Puzzle – Challenge – Error While Converting Money to Decimal [...]]]></description>
		<content:encoded><![CDATA[<p>[...] The puzzle was posted here:  SQL SERVER – Puzzle – Challenge – Error While Converting Money to Decimal [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER – 3 Simple Puzzles – Need Your Suggestions Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-103223</link>
		<dc:creator><![CDATA[SQL SERVER – 3 Simple Puzzles – Need Your Suggestions Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Wed, 01 Dec 2010 01:31:56 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-103223</guid>
		<description><![CDATA[[...] SQL SERVER – Puzzle – Challenge – Error While Converting Money to Decimal [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL SERVER – Puzzle – Challenge – Error While Converting Money to Decimal [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SHIVSHANKER</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-102787</link>
		<dc:creator><![CDATA[SHIVSHANKER]]></dc:creator>
		<pubDate>Mon, 29 Nov 2010 12:50:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-102787</guid>
		<description><![CDATA[DECLARE @mymoney MONEY;
SET @mymoney = 12345.67;
SELECT CAST(@mymoney AS DECIMAL(5,2)) MoneyInt;


SIR HERE THE DECIMAL VALUE ACCEPT 

DECIMAL(TOTAL DIGIT,DECIMAL POINT AFTER DIGIT)

SO USE

SELECT CAST(@mymoney AS DECIMAL(7,2)) MoneyInt;

IT WILL RUN]]></description>
		<content:encoded><![CDATA[<p>DECLARE @mymoney MONEY;<br />
SET @mymoney = 12345.67;<br />
SELECT CAST(@mymoney AS DECIMAL(5,2)) MoneyInt;</p>
<p>SIR HERE THE DECIMAL VALUE ACCEPT </p>
<p>DECIMAL(TOTAL DIGIT,DECIMAL POINT AFTER DIGIT)</p>
<p>SO USE</p>
<p>SELECT CAST(@mymoney AS DECIMAL(7,2)) MoneyInt;</p>
<p>IT WILL RUN</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER – Challenge – Puzzle – Why does RIGHT JOIN Exists Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-102549</link>
		<dc:creator><![CDATA[SQL SERVER – Challenge – Puzzle – Why does RIGHT JOIN Exists Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Sun, 28 Nov 2010 01:31:50 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-102549</guid>
		<description><![CDATA[[...] SQL SERVER – Puzzle – Challenge – Error While Converting Money to Decimal [...]]]></description>
		<content:encoded><![CDATA[<p>[...] SQL SERVER – Puzzle – Challenge – Error While Converting Money to Decimal [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daniel Abbatt</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-102534</link>
		<dc:creator><![CDATA[Daniel Abbatt]]></dc:creator>
		<pubDate>Sat, 27 Nov 2010 22:22:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-102534</guid>
		<description><![CDATA[Exactly. It&#039;s not 5 number followed by 2 numbers. 5, 2 means that it&#039;s 5 digits in total with 2 after the decimal point. To represent the number you show, it needs a total of 7 with 2 after the decimal place and 5 before.]]></description>
		<content:encoded><![CDATA[<p>Exactly. It&#8217;s not 5 number followed by 2 numbers. 5, 2 means that it&#8217;s 5 digits in total with 2 after the decimal point. To represent the number you show, it needs a total of 7 with 2 after the decimal place and 5 before.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Imran Mohammed</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-102503</link>
		<dc:creator><![CDATA[Imran Mohammed]]></dc:creator>
		<pubDate>Sat, 27 Nov 2010 17:15:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-102503</guid>
		<description><![CDATA[Decimal data type is defined as Decimal (Precision, Scale).

Precision includes Scale. 

So Decimal (5,2) actually means, we can have 3 digits before decimal and 2 digits after decimal. 

From above example,  (3+2) digits is called as precision and 2 digits after decimal is callled as scale. 

In your example, you have 5 digits before decimal and 2 digits after decimal, therefore the correct decimal should be Decimal (7,2).

~ IM.]]></description>
		<content:encoded><![CDATA[<p>Decimal data type is defined as Decimal (Precision, Scale).</p>
<p>Precision includes Scale. </p>
<p>So Decimal (5,2) actually means, we can have 3 digits before decimal and 2 digits after decimal. </p>
<p>From above example,  (3+2) digits is called as precision and 2 digits after decimal is callled as scale. </p>
<p>In your example, you have 5 digits before decimal and 2 digits after decimal, therefore the correct decimal should be Decimal (7,2).</p>
<p>~ IM.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alok Chandra Shahi</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-102486</link>
		<dc:creator><![CDATA[Alok Chandra Shahi]]></dc:creator>
		<pubDate>Sat, 27 Nov 2010 14:33:10 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-102486</guid>
		<description><![CDATA[You are taking 5 in place of 7.Because here length of This Money type variable will be fit in 5 digit before decimal point so you should take at least 5 digit in decimal datatype. digit after decimal will be round off.



DECLARE @mymoney MONEY;
SET @mymoney = 12345.67;
SELECT CAST(@mymoney AS DECIMAL(7,2)) MoneyInt;]]></description>
		<content:encoded><![CDATA[<p>You are taking 5 in place of 7.Because here length of This Money type variable will be fit in 5 digit before decimal point so you should take at least 5 digit in decimal datatype. digit after decimal will be round off.</p>
<p>DECLARE @mymoney MONEY;<br />
SET @mymoney = 12345.67;<br />
SELECT CAST(@mymoney AS DECIMAL(7,2)) MoneyInt;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Humphrey</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-102471</link>
		<dc:creator><![CDATA[Scott Humphrey]]></dc:creator>
		<pubDate>Sat, 27 Nov 2010 12:06:19 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-102471</guid>
		<description><![CDATA[You need to define the decimal larger to cast money to]]></description>
		<content:encoded><![CDATA[<p>You need to define the decimal larger to cast money to</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chintak Chhapia</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-102466</link>
		<dc:creator><![CDATA[Chintak Chhapia]]></dc:creator>
		<pubDate>Sat, 27 Nov 2010 11:47:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-102466</guid>
		<description><![CDATA[Yes I agree with Fbncs.

Just adding description for whay it&#039;s filing when we rty to convert it to Decimal(5,2)

In decimal decalaration, DECIMAL(P,S), P (precision) specifies the number of digits on both side of decimal point. 12345.67 has 7 digits ( of 2 digits are of scale), so we need decimal(5,2) for storing this number.

Even if we tries to convert the number to DECIMAL(7,3), we get same error as we specify scale as 3 and so, we can have only 4 digits on left side of decimal point.

-Chintak]]></description>
		<content:encoded><![CDATA[<p>Yes I agree with Fbncs.</p>
<p>Just adding description for whay it&#8217;s filing when we rty to convert it to Decimal(5,2)</p>
<p>In decimal decalaration, DECIMAL(P,S), P (precision) specifies the number of digits on both side of decimal point. 12345.67 has 7 digits ( of 2 digits are of scale), so we need decimal(5,2) for storing this number.</p>
<p>Even if we tries to convert the number to DECIMAL(7,3), we get same error as we specify scale as 3 and so, we can have only 4 digits on left side of decimal point.</p>
<p>-Chintak</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paulo R. Pereira</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-102457</link>
		<dc:creator><![CDATA[Paulo R. Pereira]]></dc:creator>
		<pubDate>Sat, 27 Nov 2010 10:32:09 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-102457</guid>
		<description><![CDATA[Hi Pinal,

The overflow problem is because the length of DECIMAL(5,2) is small to support this value.

In this case, the value 12345.67 has length (precision) of 7 digits, when 2 digits are dedicated to &quot;.67&quot; (scale), then you can convert this number to a DECIMAL(7,2) and not to a DECIMAL(5,2).

DECLARE @mymoney MONEY;
SET @mymoney = 12345.67;
SELECT CAST(@mymoney AS DECIMAL(7,2)) MoneyInt;
GO

But you can lost the 2 digits dedicated to &quot;.67&quot;, if you use a small decimal with a compatible precision without scale:

DECLARE @mymoney MONEY;
SET @mymoney = 12345.67;
SELECT CAST(@mymoney AS DECIMAL(5,0)) MoneyInt;
GO]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>The overflow problem is because the length of DECIMAL(5,2) is small to support this value.</p>
<p>In this case, the value 12345.67 has length (precision) of 7 digits, when 2 digits are dedicated to &#8220;.67&#8243; (scale), then you can convert this number to a DECIMAL(7,2) and not to a DECIMAL(5,2).</p>
<p>DECLARE @mymoney MONEY;<br />
SET @mymoney = 12345.67;<br />
SELECT CAST(@mymoney AS DECIMAL(7,2)) MoneyInt;<br />
GO</p>
<p>But you can lost the 2 digits dedicated to &#8220;.67&#8243;, if you use a small decimal with a compatible precision without scale:</p>
<p>DECLARE @mymoney MONEY;<br />
SET @mymoney = 12345.67;<br />
SELECT CAST(@mymoney AS DECIMAL(5,0)) MoneyInt;<br />
GO</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: aasim abdullah</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-102450</link>
		<dc:creator><![CDATA[aasim abdullah]]></dc:creator>
		<pubDate>Sat, 27 Nov 2010 09:31:03 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-102450</guid>
		<description><![CDATA[Query from &quot;fbncs&quot; is correct because decimal data type takes 2 bytes of overhead to store the offset to the value. Which money don&#039;t. Thats why converting from money to decimal need 2 bytes extra otherwise enjoy arithmetic overflow error ;)]]></description>
		<content:encoded><![CDATA[<p>Query from &#8220;fbncs&#8221; is correct because decimal data type takes 2 bytes of overhead to store the offset to the value. Which money don&#8217;t. Thats why converting from money to decimal need 2 bytes extra otherwise enjoy arithmetic overflow error ;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anurodh Srivastava</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-102442</link>
		<dc:creator><![CDATA[Anurodh Srivastava]]></dc:creator>
		<pubDate>Sat, 27 Nov 2010 08:24:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-102442</guid>
		<description><![CDATA[DECLARE @mymoney MONEY;
SET @mymoney = 12345.67;
SELECT CAST(@mymoney AS DECIMAL(7,2)) MoneyInt;
GO?

Now it will not through any error.
Since @mymoney variable has 5 digits before decimal and 2 digits after decimal. So we have to put 7 insead of 5 in precision of DECIMAl Datatype, because 5 + 2 = 7 means total no of digits that DECIMAL datatype may contain before decimal and after decimal place.
For understanding, you can also see it like this DECIMAL((7-2),2).

Have a look the detail given below for more clarity-
DECIMAL(p,s)
p (precision) 
The maximum total number of decimal digits that can be stored, both to the left and to the right of the decimal point.
s (scale) 
The maximum number of decimal digits that can be stored to the right of the decimal point.]]></description>
		<content:encoded><![CDATA[<p>DECLARE @mymoney MONEY;<br />
SET @mymoney = 12345.67;<br />
SELECT CAST(@mymoney AS DECIMAL(7,2)) MoneyInt;<br />
GO?</p>
<p>Now it will not through any error.<br />
Since @mymoney variable has 5 digits before decimal and 2 digits after decimal. So we have to put 7 insead of 5 in precision of DECIMAl Datatype, because 5 + 2 = 7 means total no of digits that DECIMAL datatype may contain before decimal and after decimal place.<br />
For understanding, you can also see it like this DECIMAL((7-2),2).</p>
<p>Have a look the detail given below for more clarity-<br />
DECIMAL(p,s)<br />
p (precision)<br />
The maximum total number of decimal digits that can be stored, both to the left and to the right of the decimal point.<br />
s (scale)<br />
The maximum number of decimal digits that can be stored to the right of the decimal point.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Himanshu Patel</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-102435</link>
		<dc:creator><![CDATA[Himanshu Patel]]></dc:creator>
		<pubDate>Sat, 27 Nov 2010 07:07:27 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-102435</guid>
		<description><![CDATA[Hi pinal

as per the bol.

In Transact-SQL statements, a constant with a decimal point is automatically converted into a numeric data value, using the minimum precision and scale necessary. For example, the constant 12345.67 is converted into a numeric value with a precision of 7 and a scale of 2.

bol link :  http://msdn.microsoft.com/en-us/library/ms191530.aspx

section : Converting decimal and numeric Data]]></description>
		<content:encoded><![CDATA[<p>Hi pinal</p>
<p>as per the bol.</p>
<p>In Transact-SQL statements, a constant with a decimal point is automatically converted into a numeric data value, using the minimum precision and scale necessary. For example, the constant 12345.67 is converted into a numeric value with a precision of 7 and a scale of 2.</p>
<p>bol link :  <a href="http://msdn.microsoft.com/en-us/library/ms191530.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms191530.aspx</a></p>
<p>section : Converting decimal and numeric Data</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajan Patel</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-102431</link>
		<dc:creator><![CDATA[Rajan Patel]]></dc:creator>
		<pubDate>Sat, 27 Nov 2010 06:52:14 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-102431</guid>
		<description><![CDATA[DECIMAL(5,2) has 5 precision and 2 scale.

Precision is the total number of digits in a number.

Scale is the number of digits to the right of the decimal point in a number.

For Example the number 8714.235 has a

precision – 7

scale – 3]]></description>
		<content:encoded><![CDATA[<p>DECIMAL(5,2) has 5 precision and 2 scale.</p>
<p>Precision is the total number of digits in a number.</p>
<p>Scale is the number of digits to the right of the decimal point in a number.</p>
<p>For Example the number 8714.235 has a</p>
<p>precision – 7</p>
<p>scale – 3</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: sandman</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-102429</link>
		<dc:creator><![CDATA[sandman]]></dc:creator>
		<pubDate>Sat, 27 Nov 2010 06:23:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-102429</guid>
		<description><![CDATA[I agree with fbncs.]]></description>
		<content:encoded><![CDATA[<p>I agree with fbncs.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Keval Patel</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-102427</link>
		<dc:creator><![CDATA[Keval Patel]]></dc:creator>
		<pubDate>Sat, 27 Nov 2010 06:06:15 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-102427</guid>
		<description><![CDATA[You need to specify 

DECLARE @mymoney MONEY;
SET @mymoney = -12345.67;
SELECT CAST(@mymoney AS DECIMAL(7,2)) MoneyInt;

Because...

Here first part specifies total number of decimals. i.e. number of characters before &quot;Period&quot; (.) + number of characters after &quot;Period&quot; (.)

5+2 = 7

Second part sepcifies how many characters should be after &quot;Period&quot; (.)]]></description>
		<content:encoded><![CDATA[<p>You need to specify </p>
<p>DECLARE @mymoney MONEY;<br />
SET @mymoney = -12345.67;<br />
SELECT CAST(@mymoney AS DECIMAL(7,2)) MoneyInt;</p>
<p>Because&#8230;</p>
<p>Here first part specifies total number of decimals. i.e. number of characters before &#8220;Period&#8221; (.) + number of characters after &#8220;Period&#8221; (.)</p>
<p>5+2 = 7</p>
<p>Second part sepcifies how many characters should be after &#8220;Period&#8221; (.)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anil Gurjar</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-102426</link>
		<dc:creator><![CDATA[Anil Gurjar]]></dc:creator>
		<pubDate>Sat, 27 Nov 2010 06:04:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-102426</guid>
		<description><![CDATA[you must do :

DECLARE @mymoney MONEY;
SET @mymoney = 12345.67;
SELECT CAST(@mymoney AS DECIMAL(abc,2)) MoneyInt;

you have 7 digits in @mymoney (including decimals) so you put abc=7 or greater than 7]]></description>
		<content:encoded><![CDATA[<p>you must do :</p>
<p>DECLARE @mymoney MONEY;<br />
SET @mymoney = 12345.67;<br />
SELECT CAST(@mymoney AS DECIMAL(abc,2)) MoneyInt;</p>
<p>you have 7 digits in @mymoney (including decimals) so you put abc=7 or greater than 7</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anil Gurjar</title>
		<link>http://blog.sqlauthority.com/2010/11/27/sql-server-puzzle-challenge-error-while-converting-money-to-decimal/#comment-102425</link>
		<dc:creator><![CDATA[Anil Gurjar]]></dc:creator>
		<pubDate>Sat, 27 Nov 2010 06:02:07 +0000</pubDate>
		<guid isPermaLink="false">http://blog.sqlauthority.com/?p=10995#comment-102425</guid>
		<description><![CDATA[you must do :

DECLARE @mymoney MONEY;
SET @mymoney = 12345.67;
SELECT CAST(@mymoney AS DECIMAL(,2)) MoneyInt;

you have 7 digits in @mymoney (including decimals)]]></description>
		<content:encoded><![CDATA[<p>you must do :</p>
<p>DECLARE @mymoney MONEY;<br />
SET @mymoney = 12345.67;<br />
SELECT CAST(@mymoney AS DECIMAL(,2)) MoneyInt;</p>
<p>you have 7 digits in @mymoney (including decimals)</p>
]]></content:encoded>
	</item>
</channel>
</rss>
