Created
September 29, 2023 12:36
-
-
Save ststeiger/3a7330c82da333aaae06a7dddd6a99fd to your computer and use it in GitHub Desktop.
DIN A Series Paper Size
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;WITH CTE AS | |
( | |
SELECT | |
0 AS i | |
,CAST('A0' AS varchar(10)) AS paper_format | |
,841e AS width | |
,1189e AS height | |
,841e AS orig_width | |
,1189e AS orig_height | |
,CAST('1 A0 sheet' AS varchar(100)) AS equivalent_to | |
UNION ALL | |
SELECT | |
i+1 | |
,'A' + CAST(CTE.i+1 AS varchar(9)) AS paper_format | |
-- ,CTE.width AS width | |
-- ,CTE.height AS height | |
--,FLOOR(841/POWER(SQRT(2), 0)) | |
-- ,FLOOR(CTE.width/SQRT(2)) AS width | |
--,,ROUND(CTE.width/SQRT(2), 0) AS width | |
--,ROUND(CTE.height/SQRT(2), 0) AS height | |
--,FLOOR(CTE.orig_width/POWER(SQRT(2), i+1)) AS width | |
--,FLOOR(CTE.orig_height/POWER(SQRT(2), i+1)) AS height | |
--,ROUND(CTE.orig_width/POWER(SQRT(2), i+1), 0) AS width | |
--,ROUND(CTE.orig_height/POWER(SQRT(2), i+1), 0) AS height | |
-- height = width x √2. | |
,FLOOR(CTE.orig_width/POWER(SQRT(2), i+1)) AS width | |
,CTE.width AS height | |
-- ,FLOOR(CTE.width/SQRT(2)) AS width | |
-- ,CTE.width AS height | |
--,(CTE.orig_width/POWER(SQRT(2), i+1)) AS width | |
--,(CTE.orig_height/POWER(SQRT(2), i+1)) AS height | |
,CTE.orig_width | |
,CTE.orig_height | |
,CAST(POWER(2, CTE.i+1) AS varchar(10)) | |
+ ' A' | |
+ CAST(CTE.i+1 AS varchar(81)) | |
+ ' sheets' | |
AS equivalent_to | |
FROM CTE | |
WHERE i < 20 | |
) | |
-- https://www.brother.co.uk/support/answers/is-a3-bigger-than-a4 | |
-- https://www.adobe.com/uk/creativecloud/design/discover/a1-format.html | |
SELECT | |
i | |
,paper_format | |
,width | |
,height | |
,equivalent_to | |
FROM CTE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment