December 4, 2018 at 12:01 am
Comments posted to this topic are about the item PackPrecScale CLR function
December 4, 2018 at 10:17 am
Hello Claude. Congrats on publishing your first article on SQL Server Central :-). I think this article is off to a good start, but is incomplete and could use a bit more explanation and examples. For example:
For the initial T-SQL example code in the article that is trying to explain the problem to the reader, you really should show the output of those statements since many readers will not have SSMS open and hence not be able to execute those statements to see what they produce. Below is an example of how to show the output. I also included an additional variable to show the effect of using a properly sized DECIMAL type:
DECLARE @D1 DECIMAL(38, 18) = 1.123456789012345678;
DECLARE @D2 DECIMAL(38, 18) = 1.0;
DECLARE @D3 DECIMAL(1, 0) = 1.0;
DECLARE @D4 DECIMAL(20, 18) = 1.123456789012345678;
SELECT @D1 AS [D1 -- DECIMAL(38, 18)], -- 1.123456789012345678
@D4 AS [D4 -- DECIMAL(20, 18)]; -- 1.123456789012345678
SELECT @D1 * @D2 AS [DEC(38, 18) * DEC(38, 18)], -- 1.123457
@D1 * @D3 AS [DEC(38, 18) * DEC(1, 0)], -- 1.1234567890123457
@D4 * @D2 AS [DEC(20, 18) * DEC(38, 18)]; -- 1.123456789012346
Good luck! Take care, Solomon...
SQL# — https://SQLsharp.com/ ( SQLCLR library ofover 340 Functions and Procedures)
Sql Quantum Lift — https://SqlQuantumLift.com/ ( company )
Sql Quantum Leap — https://SqlQuantumLeap.com/ ( blog )
Info sites — Collations • Module Signing • SQLCLR
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply