I need high calculated columns with high-precision & scale Decimal types in Views/ SP's in SQL Server. As the calculations go through several layers of high precision with multiplication/ division operations the precision requirements are huge. The problem is sometimes big numbers will be inputted by the user in different columns; sometimes large amounts in column-A, small amounts in B, big amounts in C... with many permutations and more columns than mentioned.
Ideally the Decimal type would be able to handle these large numbers & precision that I need & I would safely design within the constraints of the Decimal type. This is not possible as the precision & scale of numbers is too big. It may seem like overkill but I'm pretty sure the math is correct. The best way to get around this seems to be CASTING the type in each layered calculation, reducing precision whilst maintaining high scale (decimal places). This is a brilliant solution to work within precision & scales. However this leaves me vulnerable to overflow errors should the integral (nr before decimal place) exceeds the storage capacity. It seems the scale (dp) will be truncated to accommodate larger integrals when the values > the cast type, which is fine & this is the reason the decimal type behaves in this way for good reason & an overflow error will not be thrown on the scale. Fine that's excellent, no probs there.
Views
They're simplest for my requirements for data sources of my forms in Access. However I cannot see how to catch an Overflow Error in a SQL Server View? Then how to handle that error in MS Access?
When an overflow error occurs in a view the form the user gets no notification of an error. It's as if the data source detaches - catastrophic failure. One would think the transaction would be rolled back & a notification to the user. We also need to hit "Refresh All" button in Access after entering a rogue value; or the user is unaware a sinister value just caused an overflow error.
Testing the many different possible permutations of data entry isn't going to be possible as there are so many different permutations. Ideally I want to capture the overflow error in SQL Server & revert the transaction with a notification in Access.
Any ideas on what to do? SP's it seems TRY & CATCH blocks to capture an arithmetic overflow error but can't do them in Views.
Ideally the Decimal type would be able to handle these large numbers & precision that I need & I would safely design within the constraints of the Decimal type. This is not possible as the precision & scale of numbers is too big. It may seem like overkill but I'm pretty sure the math is correct. The best way to get around this seems to be CASTING the type in each layered calculation, reducing precision whilst maintaining high scale (decimal places). This is a brilliant solution to work within precision & scales. However this leaves me vulnerable to overflow errors should the integral (nr before decimal place) exceeds the storage capacity. It seems the scale (dp) will be truncated to accommodate larger integrals when the values > the cast type, which is fine & this is the reason the decimal type behaves in this way for good reason & an overflow error will not be thrown on the scale. Fine that's excellent, no probs there.
Views
They're simplest for my requirements for data sources of my forms in Access. However I cannot see how to catch an Overflow Error in a SQL Server View? Then how to handle that error in MS Access?
When an overflow error occurs in a view the form the user gets no notification of an error. It's as if the data source detaches - catastrophic failure. One would think the transaction would be rolled back & a notification to the user. We also need to hit "Refresh All" button in Access after entering a rogue value; or the user is unaware a sinister value just caused an overflow error.
Testing the many different possible permutations of data entry isn't going to be possible as there are so many different permutations. Ideally I want to capture the overflow error in SQL Server & revert the transaction with a notification in Access.
Any ideas on what to do? SP's it seems TRY & CATCH blocks to capture an arithmetic overflow error but can't do them in Views.