I was still curious as to the Character Value rank and after a search for a listing of Characters and their SQL ranking came up empty, I decided to create one with the code below.
In the T-SQL script, I first create a Table Variable to contain the results. I then populate the table with the potential characters using a WHILE loop and the CHAR() function. I then use an UPDATE and SELECT statement to calculate the Value Rank of the Character. Lastly, the results are displayed in Value Rank order.
Declare @Tbl Table (CharInteger integer, CharResult varchar, ValueRank Integer); Declare @iCount integer; SET @iCount = 0; While @iCount <= 255 BEGIN INSERT INTO @Tbl VALUES (@iCount, Char(@iCount), 0); SET @iCount = @iCount + 1; END; UPDATE @Tbl SET ValueRank = (SELECT COUNT(*) from @Tbl B WHERE B.CharResult < [@Tbl].CharResult); SELECT * FROM @Tbl ORDER BY ValueRank;