Jika Anda memiliki SQL 2008 Anda dapat menggunakan tipe data hierarkiid baru:
WITH Items (ItemNumber) AS (
SELECT '1' UNION ALL SELECT '1.1' UNION ALL SELECT '1.1.1'
UNION ALL SELECT '10' UNION ALL SELECT '11' UNION ALL SELECT '2'
UNION ALL SELECT '2.1' UNION ALL SELECT '20' UNION ALL SELECT '3'
UNION ALL SELECT '30'
)
SELECT *
FROM Items
ORDER BY Convert(hierarchyid, '/' + ItemNumber + '/');