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: Today @ 9:23 AM
Points: 5,925, Visits: 8,173
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: Monday, June 16, 2014 9:38 AM
Points: 2,163, Visits: 2,189
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: Today @ 1:28 PM
Points: 13,280, Visits: 10,155
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, July 22, 2014 1:45 AM
Points: 2,826, Visits: 3,866
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: Thursday, January 30, 2014 9:03 AM
Points: 15, Visits: 63
interesting...

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


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 1:17 PM
Points: 2,658, Visits: 19,190
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: Today @ 12:42 PM
Points: 5,571, Visits: 24,779
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: Thursday, July 24, 2014 8:41 AM
Points: 2,818, Visits: 2,553
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: Today @ 9:23 AM
Points: 5,925, Visits: 8,173
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