<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Conversion and Arithmetic Errors</title><link>http://blogs.msdn.com/craigfr/archive/2008/04/28/conversion-and-arithmetic-errors.aspx</link><description>Let's take a look at a simple query: CREATE TABLE T1 (A INT, B CHAR(8)) INSERT T1 VALUES (0, '0') INSERT T1 VALUES (1, '1') INSERT T1 VALUES (99, 'Error') SELECT T1.A, CONVERT(INT, T1.B) AS B_INT FROM T1 There is no way to convert the string "Error" into</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: Conversion and Arithmetic Errors</title><link>http://blogs.msdn.com/craigfr/archive/2008/04/28/conversion-and-arithmetic-errors.aspx#8463609</link><pubDate>Tue, 06 May 2008 21:21:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8463609</guid><dc:creator>HKornelis</dc:creator><description>&lt;p&gt;Hi Craig,&lt;/p&gt;
&lt;p&gt;Yet another excellent post!&lt;/p&gt;
&lt;p&gt;However, just as an FYI, there is a shorter way to avoid the division by zero error:&lt;/p&gt;
&lt;p&gt;SELECT T1.A,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;1 / NULL(T1.A, 0) AS A_Reciprocal&lt;/p&gt;
&lt;p&gt;FROM T1 JOIN T2 ON T1.A = T2.X;&lt;/p&gt;
&lt;p&gt;Best, Hugo&lt;/p&gt;
</description></item><item><title>Conversion and Arithmetic Errors: Change between SQL Server 2000 and 2005</title><link>http://blogs.msdn.com/craigfr/archive/2008/04/28/conversion-and-arithmetic-errors.aspx#8463684</link><pubDate>Tue, 06 May 2008 22:02:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8463684</guid><dc:creator>Craig Freedman's SQL Server Blog</dc:creator><description>&lt;p&gt;In this post from last week, I gave an example of a query with a conversion where the optimizer pushes&lt;/p&gt;
</description></item><item><title>re: Conversion and Arithmetic Errors</title><link>http://blogs.msdn.com/craigfr/archive/2008/04/28/conversion-and-arithmetic-errors.aspx#8463710</link><pubDate>Tue, 06 May 2008 22:17:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8463710</guid><dc:creator>craigfr</dc:creator><description>&lt;p&gt;Hi Hugo,&lt;/p&gt;
&lt;p&gt;Thanks for the tip. &amp;nbsp;I believe that you meant to write NULLIF (rather than just NULL):&lt;/p&gt;
&lt;p&gt;SELECT T1.A,&lt;/p&gt;
&lt;p&gt; &amp;nbsp; 1 / NULLIF(T1.A, 0) AS A_Reciprocal&lt;/p&gt;
&lt;p&gt;FROM T1 JOIN T2 ON T1.A = T2.X&lt;/p&gt;
&lt;p&gt;Craig&lt;/p&gt;
</description></item><item><title>re: Conversion and Arithmetic Errors</title><link>http://blogs.msdn.com/craigfr/archive/2008/04/28/conversion-and-arithmetic-errors.aspx#8465246</link><pubDate>Wed, 07 May 2008 10:17:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8465246</guid><dc:creator>HKornelis</dc:creator><description>&lt;p&gt;Hi Craig,&lt;/p&gt;
&lt;p&gt;Yes, that was exactly what I meant. Thanks for catching my typo!&lt;/p&gt;
&lt;p&gt;Best, Hugo&lt;/p&gt;
</description></item></channel></rss>