• The question itself was OK, as a test to see what output the T-SQL would give.

    But not OK for the purpose mentioned in the explanation, as there are other statements that will do it much better and faster (as Oleg has already mentioned).

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP