﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Article Discussions by Author / Discuss content posted by SQL Buzz  / Predict the outcome of the SQL statements / 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>Fri, 24 May 2013 10:00:08 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Predict the outcome of the SQL statements</title><link>http://www.sqlservercentral.com/Forums/Topic1014270-2715-1.aspx</link><description>Nice question. Thanks</description><pubDate>Tue, 09 Nov 2010 01:40:31 GMT</pubDate><dc:creator>Hardy21</dc:creator></item><item><title>RE: Predict the outcome of the SQL statements</title><link>http://www.sqlservercentral.com/Forums/Topic1014270-2715-1.aspx</link><description>Good question, although it was more about convert than about ceiling.A link to the msdn page for convert and decimal:[url]http://msdn.microsoft.com/en-us/library/ms187928(SQL.90).aspx[/url] (convert)[url]http://msdn.microsoft.com/en-us/library/ms187746.aspx[/url] (decimal/numeric)The last page describes the gotcha of this question in the explanation of the scale.</description><pubDate>Wed, 03 Nov 2010 13:01:59 GMT</pubDate><dc:creator>Koen Verbeeck</dc:creator></item><item><title>RE: Predict the outcome of the SQL statements</title><link>http://www.sqlservercentral.com/Forums/Topic1014270-2715-1.aspx</link><description>Thanks for the question.</description><pubDate>Tue, 02 Nov 2010 14:26:06 GMT</pubDate><dc:creator>SQLRNNR</dc:creator></item><item><title>RE: Predict the outcome of the SQL statements</title><link>http://www.sqlservercentral.com/Forums/Topic1014270-2715-1.aspx</link><description>[quote][b]Tom.Thomson (11/2/2010)[/b][hr]Good question, but as some have already noted the explanation is a bit lacking.Also, the question was made too easy by the absence of the All 2s option as an answer choice - anyone who knows what ceiling means can eliminate all answers but the correct one with knowing anything at all about decimal or its default precision.[/quote]Yes, I agree.  The best wrong answer was missing.</description><pubDate>Tue, 02 Nov 2010 09:55:30 GMT</pubDate><dc:creator>Cliff Jones</dc:creator></item><item><title>RE: Predict the outcome of the SQL statements</title><link>http://www.sqlservercentral.com/Forums/Topic1014270-2715-1.aspx</link><description>Good question, but as some have already noted the explanation is a bit lacking.Also, the question was made too easy by the absence of the All 2s option as an answer choice - anyone who knows what ceiling means can eliminate all answers but the correct one with knowing anything at all about decimal or its default precision.</description><pubDate>Tue, 02 Nov 2010 07:38:04 GMT</pubDate><dc:creator>L' Eomot Inversé</dc:creator></item><item><title>RE: Predict the outcome of the SQL statements</title><link>http://www.sqlservercentral.com/Forums/Topic1014270-2715-1.aspx</link><description>I hope one thing that everybody has learned from these questions is that you should never rely on default precision for anything - you will inevitably get it wrong sooner or later :-)</description><pubDate>Tue, 02 Nov 2010 07:06:35 GMT</pubDate><dc:creator>Toreador</dc:creator></item><item><title>RE: Predict the outcome of the SQL statements</title><link>http://www.sqlservercentral.com/Forums/Topic1014270-2715-1.aspx</link><description>Thank you Old Hand.  I knew the ceiling function brought you up to the next integer, but I couldn't figure out why the decimal was any different than the float on this one!  You're explanation was what I was missing.  For some reason I thought the default precision was 2, not 0.  I'll be sure to remember that the next time I use a decimal data type.</description><pubDate>Tue, 02 Nov 2010 06:59:03 GMT</pubDate><dc:creator>John.Norcott</dc:creator></item><item><title>RE: Predict the outcome of the SQL statements</title><link>http://www.sqlservercentral.com/Forums/Topic1014270-2715-1.aspx</link><description>Good question but I think a better explaination is:the default of decimal without parameters is (18,0) thus making 1.09 -&amp;gt; 1 and then the ceiling of 1 is 1</description><pubDate>Tue, 02 Nov 2010 06:39:50 GMT</pubDate><dc:creator>Mike Is Here</dc:creator></item><item><title>RE: Predict the outcome of the SQL statements</title><link>http://www.sqlservercentral.com/Forums/Topic1014270-2715-1.aspx</link><description>Knew the answer but had a brain fart and clicked the wrong option, oops!UMG Developer is right about the explanation.</description><pubDate>Tue, 02 Nov 2010 03:35:38 GMT</pubDate><dc:creator>Toreador</dc:creator></item><item><title>RE: Predict the outcome of the SQL statements</title><link>http://www.sqlservercentral.com/Forums/Topic1014270-2715-1.aspx</link><description>Nice question, thanks! Though I think the explanation left a little to be desired. It isn't just that the decimal type was used, it was that the decimal type was used and no precision/scale was specified, so the number got rounded down to 1.0 when it was converted.For example this results in the same thing as all of your float examples:[code="sql"]select Ceiling(convert(decimal(2, 1), 1.09))[/code]Because with a scale of one specified it gets rounded to 1.1 before it goes to ceiling.</description><pubDate>Tue, 02 Nov 2010 00:16:25 GMT</pubDate><dc:creator>UMG Developer</dc:creator></item><item><title>Predict the outcome of the SQL statements</title><link>http://www.sqlservercentral.com/Forums/Topic1014270-2715-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/questions/Convert/70633/"&gt;Predict the outcome of the SQL statements&lt;/A&gt;[/B]</description><pubDate>Mon, 01 Nov 2010 22:24:20 GMT</pubDate><dc:creator>bazzkar</dc:creator></item></channel></rss>