December 13, 2018 at 1:39 pm
RonKyle - Thursday, December 13, 2018 12:41 PMEric M Russell - Thursday, December 13, 2018 12:19 PMt.franz - Thursday, December 13, 2018 8:46 AMWorst data types: I've seen money values, that are usually < 100 EUR be stored in DECIMAL(38,17) columns (and many percentage columns with the same declaration too).Perhaps the data modeler is hedging against monetary hyper inflation.
Why all the decimals then?
Probably to replace "FLOAT" when it comes to calculations such as mortgage interest calculations. One of the keys to such calculations is to never store the results formatted for human consumption. Whoever did this is likely unaware of the truncation to just 6 decimal places under certain conditions, especially the conditions created by multiplication.
--Jeff Moden
Change is inevitable... Change for the better is not.
December 13, 2018 at 5:31 pm
Jeff Moden - Thursday, December 13, 2018 1:39 PMRonKyle - Thursday, December 13, 2018 12:41 PMEric M Russell - Thursday, December 13, 2018 12:19 PMt.franz - Thursday, December 13, 2018 8:46 AMWorst data types: I've seen money values, that are usually < 100 EUR be stored in DECIMAL(38,17) columns (and many percentage columns with the same declaration too).Perhaps the data modeler is hedging against monetary hyper inflation.
Why all the decimals then?
Probably to replace "FLOAT" when it comes to calculations such as mortgage interest calculations. One of the keys to such calculations is to never store the results formatted for human consumption. Whoever did this is likely unaware of the truncation to just 6 decimal places under certain conditions, especially the conditions created by multiplication.
I'm not sure I understand the answer. Are you saying that decimals to this place are necessary for interest calculations? For money I've used decimal(19,4) thinking four decimals was more than enough. Is that sound?
December 14, 2018 at 7:23 am
RonKyle - Thursday, December 13, 2018 5:31 PMJeff Moden - Thursday, December 13, 2018 1:39 PMRonKyle - Thursday, December 13, 2018 12:41 PMEric M Russell - Thursday, December 13, 2018 12:19 PMt.franz - Thursday, December 13, 2018 8:46 AMWorst data types: I've seen money values, that are usually < 100 EUR be stored in DECIMAL(38,17) columns (and many percentage columns with the same declaration too).Perhaps the data modeler is hedging against monetary hyper inflation.
Why all the decimals then?
Probably to replace "FLOAT" when it comes to calculations such as mortgage interest calculations. One of the keys to such calculations is to never store the results formatted for human consumption. Whoever did this is likely unaware of the truncation to just 6 decimal places under certain conditions, especially the conditions created by multiplication.
I'm not sure I understand the answer. Are you saying that decimals to this place are necessary for interest calculations? For money I've used decimal(19,4) thinking four decimals was more than enough. Is that sound?
Agreed. I may not have a real handle on this, but it seems to me as if rounding to cents anyway, even interest calculations don't need a whole lot of decimal places. If I'm not mistaken, once you get to the second place beyond the one cent point, can anything else change the rounding? The only place i seem to use more decimals is when I'm trying to match to an existing number, such as in reconciling my investment transactions where I need to reconcile to the transaction total the broker presents by entering more decimals until the totals match. Probably the only need for more accuracy would be if you are matching to an existing number that already has an accuracy point beyond cents. General rule might be two decimals beyond that point.
Rick
Disaster Recovery = Backup ( Backup ( Your Backup ) )
December 14, 2018 at 9:50 am
skeleton567 - Friday, December 14, 2018 7:23 AMRonKyle - Thursday, December 13, 2018 5:31 PMJeff Moden - Thursday, December 13, 2018 1:39 PMRonKyle - Thursday, December 13, 2018 12:41 PMEric M Russell - Thursday, December 13, 2018 12:19 PMt.franz - Thursday, December 13, 2018 8:46 AMWorst data types: I've seen money values, that are usually < 100 EUR be stored in DECIMAL(38,17) columns (and many percentage columns with the same declaration too).Perhaps the data modeler is hedging against monetary hyper inflation.
Why all the decimals then?
Probably to replace "FLOAT" when it comes to calculations such as mortgage interest calculations. One of the keys to such calculations is to never store the results formatted for human consumption. Whoever did this is likely unaware of the truncation to just 6 decimal places under certain conditions, especially the conditions created by multiplication.
I'm not sure I understand the answer. Are you saying that decimals to this place are necessary for interest calculations? For money I've used decimal(19,4) thinking four decimals was more than enough. Is that sound?
Agreed. I may not have a real handle on this, but it seems to me as if rounding to cents anyway, even interest calculations don't need a whole lot of decimal places. If I'm not mistaken, once you get to the second place beyond the one cent point, can anything else change the rounding? The only place i seem to use more decimals is when I'm trying to match to an existing number, such as in reconciling my investment transactions where I need to reconcile to the transaction total the broker presents by entering more decimals until the totals match. Probably the only need for more accuracy would be if you are matching to an existing number that already has an accuracy point beyond cents. General rule might be two decimals beyond that point.
It usually has to be looked at based on your circumstances. We have had need for more than expected precision in a number of places, more than just for interest calculations.
For example, in insurance you tend to price things "per year": however things get interesting after that since not all polices are annual, change to a policy might happen part of the way through the year, or your accounting only gets to recognize premium over time. So you end up having to "prorate" (i.e. convert the price from "per year" to "per day"), and you still need the numbers to tie in no matter which of the two you use.
Extend that even a little bit further, and you might need to in some cases turn that "per building per year" price into a "per square foot per day" price, on a warehouse size building. You'd better be able to carry a LOT of extra precision or your "rounding errors" quickly climb into 100's of thousands or higher.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
December 15, 2018 at 9:25 am
even in this case (breaking down to daily or even hourly costs) you can not invoice more than rounded cents. So more precisition will only prevent rounding errors, if you have to add many mini prices and wants to round only the totoal sum.
On the other hand I worked for a telephony company before, where the telephone calls will be priced at minute level, but even they did not calculate with more than 4 decimal places.
PS: 6-fold quotes when you refer to the answere just above are very good to read and increases the clarity a lot!
God is real, unless declared integer.
December 15, 2018 at 11:29 am
It kind of brings us back to Gail's original point: understand what the data is supposed to be used for and don't just put your blinders on when deciding what data types to use.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?
December 17, 2018 at 11:41 am
....and Slashdot's quote for the day is:
God is real, unless declared integer.
-------------------------------------------------------------------------------------------------------------------------------------
Please follow Best Practices For Posting On Forums to receive quicker and higher quality responses
December 17, 2018 at 7:06 pm
PHYData DBA - Thursday, December 13, 2018 9:07 AMEric M Russell - Thursday, December 13, 2018 7:47 AMThe ISO standard for formatting date strings is YYYYMMDDWhat ISO standard is that?
ISO 8601 standard states:
"ISO 8601 tackles this uncertainty by setting out an internationally agreed way to represent dates:YYYY-MM-DD
For example, September 27, 2012 is represented as 2012-09-27."
No sir. Don't mistake an ad for information as the gospel. That's only a part of what the standard actually says.
Section 4.1.2.2 of the standard clearly states that the YYYY-MM-DD format is an allowable "extended" format and that the "basic" format is actually YYYYMMDD.
--Jeff Moden
Change is inevitable... Change for the better is not.
December 18, 2018 at 2:09 pm
I'm really surprised that no one mentioned Microsoft doing this (date and/or time as INT) in the msdb database.
SELECT * FROM dbo.sysjobhistory
Complete pain to convert that to a time format to do any sort of reporting on when jobs ran.
Viewing 9 posts - 106 through 113 (of 113 total)
You must be logged in to reply to this topic. Login to reply