select Path.ToString() as Nomer , Path, Name, Path.GetLevel() as Axixa from Users order by cast(Path as nvarchar(100)) ASC; /1/1/ /1/2/ /1/3/ /2/1/ /2/2/ /2/3/ -/214/1/- -/214/2/- /3/1/1/ /3/1/2/ should be so /1/1/ /1/2/ /1/3/ /2/1/ /2/2/ /2/3/ /3/1/1/ /3/1/2/ /214/1/ /214/2/
[Path]
HierarchyID
SELECT Path.ToString() as Nomer, Path, Name, Path.GetLevel() as Axixa FROM Users ORDER BY Path ; /* Output: /1/1/ /1/2/ /1/3/ /2/1/ /2/2/ /2/3/ /3/1/1/ /3/1/2/ /214/1/ /214/2/ */
ORDER BY RIGHT('000'+CAST(Path AS VARCHAR(3)),3) ASC
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)