This isn't a question, I just wanted to post this odd looking query result for fun.declare @num table (NUMBER varchar(20) not null primary key clustered)insert into @num (NUMBER)select n from (select n=0 union all select 1 union all select 2 union allselect 3 union all select 4 union all select 5 union allselect 6 union all select 7 union all select 8 union allselect 9 ) ndeclare @s1 varchar(25)declare @s2 varchar(25)select @s1 = '', @s2 = ''select @s1 = @s1 + NUMBER + '_' , @s2 = '_' + @s2 + NUMBERfrom @numorder by NUMBERselect S1 = @s1, S2 = @s2
Produces these results:S1 S2 ------------------------- ------------------------- 0_1_2_3_4_5_6_7_8_9_ __________0123456789
I was very puzzled at first by why all the underscores end up at the beginning of string S2, but when I really thought it through, I saw it really is correct.Is the reason instantly apparent to everyone else? Am I the only slow one?CODO ERGO SUM