What?
This is a very quick note with the code to determine the English ordinal of a date (eg. "st" of "1st"). So in a date, instead of "Tuesday, 6 November 2018", I could want "Tuesday 6th of November ...
... 01-Nov-21
// Tuesday 02-Nov-21
Note that Sunday is day 1 of the week. Saturday is day 7 of the week.
Here's the English ordinal bit I used:
m_Ordinals = ;
v_Day3_Ordinal = ifnull(m_Ordinals.get(v_NextDay.toString("d").toLong()),"th"); ...
... AS VARCHAR(10)) + ')' END
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_NAME = @TableName
ORDER BY ORDINAL_POSITION
FOR XML PATH ('')
),1,1,''
) + ';';
EXEC(@TableDeclaration);
-- ...
This was called a Data-Scrambling Function but it depends on what you mean by "scrambling". This is a function which merely uses the same characters but switches their order randomly, so I've renamed ...
...
English Ordinal Suffix in T-SQL for MDX
Working in the UK my bosses like the English Ordinal Suffix. I haven't seen this anywhere in Google, I thought I could use SWITCH to do this in an MDX query ...
We use cookies to improve your experience on our website. By browsing this website, you agree to our use of cookies. Read more about our Privacy Policy.