Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 123»»»

Round up or down III Expand / Collapse
Author
Message
Posted Monday, August 16, 2010 9:48 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 6:18 PM
Points: 6,048, Visits: 8,330
Comments posted to this topic are about the item Round up or down III


Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #970125
Posted Monday, August 16, 2010 10:32 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, September 5, 2014 2:00 PM
Points: 2,160, Visits: 2,191
Nice question, thanks! I do find it interesting that they combined rounding and truncating in one function...
Post #970135
Posted Monday, August 16, 2010 11:52 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: 2 days ago @ 11:42 AM
Points: 13,295, Visits: 11,086
Nice question, thanks. A good follow up of the previous rounding questions.
And a great explanation.




How to post forum questions.
Need an answer? No, you need a question.
What’s the deal with Excel & SSIS?

Member of LinkedIn. My blog at LessThanDot.

MCSA SQL Server 2012 - MCSE Business Intelligence
Post #970157
Posted Tuesday, August 17, 2010 12:26 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 2:56 AM
Points: 2,842, Visits: 3,876
Very good as usual:)

Best Regards,
Chris Büttner
Post #970163
Posted Tuesday, August 17, 2010 2:36 AM


Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, October 14, 2014 8:24 AM
Points: 16, Visits: 68
interesting...

__________________________________________________________
Yuvaraj
Post #970192
Posted Tuesday, August 17, 2010 6:27 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Monday, October 20, 2014 11:55 AM
Points: 1,330, Visits: 19,306
Good question Hugo, learned something new.

---------------------------------------------------------
How best to post your question
How to post performance problems
Tally Table:What it is and how it replaces a loop

"stewsterl 80804 (10/16/2009)I guess when you stop and try to understand the solution provided you not only learn, but save yourself some headaches when you need to make any slight changes."
Post #970328
Posted Tuesday, August 17, 2010 6:30 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, February 4, 2011 7:20 AM
Points: 977, Visits: 1,499
Good one. Made me look it up.

Thanks.


Tom Garth
Vertical Solutions

"There are three kinds of men. The one that learns by reading. The few who learn by observation. The rest of them have to pee on the electric fence for themselves." -- Will Rogers
Post #970330
Posted Tuesday, August 17, 2010 6:39 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Tuesday, October 14, 2014 10:58 AM
Points: 5,333, Visits: 25,272
For a completly different answer - execute the code with the setting for
ARITHABORT ON and note the difference. An important fact to be aware of.

Added after reading Hugo Kornelis Posted Today @ 9:14 AM posting

Copied and tested his code and got his answers. Unfortunately I did not save my test code and now can not duplicate my results, and I tested not less than 5 times ......... darn if I know the difference ..

SO ALL PLEASE DISREGARD MY COMMENTS ABOUT GETTING A DIFFERENT ANSWER WITH ARITHABORT SETTING!


If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #970345
Posted Tuesday, August 17, 2010 6:42 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 2:36 PM
Points: 2,818, Visits: 2,565
Great question, thanks. If I keep seeing order of precedence questions on QoTD, I will eventually have it memorized, and won't need to look it up any more.
Post #970357
Posted Tuesday, August 17, 2010 7:14 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 6:18 PM
Points: 6,048, Visits: 8,330
bitbucket-25253 (8/17/2010)
For a completly different answer - execute the code with the setting for
ARITHABORT ON and note the difference. An important fact to be aware of.

Huh? I executed this code:
SET ARITHABORT ON;
DECLARE @Result decimal(5,2);
SET @Result = ROUND(5/3.0, 1, 2);
PRINT @Result;
go
SET ARITHABORT OFF;
DECLARE @Result decimal(5,2);
SET @Result = ROUND(5/3.0, 1, 2);
PRINT @Result;

And I got 1.60 as both results. What did you get?



Hugo Kornelis, SQL Server MVP
Visit my SQL Server blog: http://sqlblog.com/blogs/hugo_kornelis
Post #970393
« Prev Topic | Next Topic »

Add to briefcase 123»»»

Permissions Expand / Collapse