DECLARE @Names TABLE ( name VARCHAR), INSERT into @Names VALUES (' Deszmetch '), (' Deszmetch '), (' Deszmetck '), (' Deszmetch '), (' Deszmetch '); SELECT name, RANK () over (ORDER by name COLLATE Latin1_General_BIN) as [Lat ... BIN], RANK () over (ORDER by name COLLATE traditional_spanish_ci_as) as [Tra ... Ci_as], RANK () over (ORDER by name COLLATE latin1_general_cs_as) as [Lat ... Cs_as], RANK () over (ORDER by name COLLATE latin1_general_ci_as) as [Lat ... Ci_as], RANK () over (ORDER by name COLLATE hungarian_ci_as) as [Hun..._ci_as]from @NamesORDER by name COLLATE Latin1_g Eneral_bin; GO
---order do not follow the fields can be different, but will be in the last sort order
DECLARE @Student Table --Student score table (ID int, --primary key Grade int,--Class score int,--score name VARCHAR ()- -name) INSERT int O @Student VALUES (1,1,88, ' A1 '), (2,1,66, ' B1 '), (3,1,75, ' C1 '), (4,2,30, ' D1 '), (5,2,70, ' E1 '), (6,2,80, ' F1 '), (7,2,60, ' G1 ') '), (8,3,90, ' H1 '), (9,3,70, ' I1 '), (10,3,80, ' J1 ')--select * from @StudentSELECT Name,score,rank () over (ORDER by Grade DESC) as Rankgrade,rank () over (order BY score Desc) as Rankscore,rank () over (order by ID DESC) as Rankidfrom @St Udent
SQL Tech Insider-usage of 6 rank () over (order by XX COLLATE)