j'ai un domaine comme:Aide T-sql règles de tri spéciales
SELECT * FROM
(
SELECT 'A9t' AS sortField UNION ALL
SELECT 'A10t' UNION ALL
SELECT 'A11t' UNION ALL
SELECT 'AB9F' UNION ALL
SELECT 'AB10t' UNION ALL
SELECT 'AB11t'
) t ORDER BY sortField
et le résultat est:
sortField
---------
A10t
A11t
A9t
AB10t
AB11t
AB9F
En fait, j'ai besoin est de combiner les règles de tri de chaînes et numéro:
sortField
---------
A9t
A10t
A11t
AB9F
AB10t
AB11t
Il y a toujours une lettre à l'avant? – CristiC
Non, peut être 'Abc9t' – guaike
Je pense que ça s'appelle "ordre naturel". Il y a déjà la même question (?) [Ici] (http://stackoverflow.com/questions/34509/natural-human-alpha-numeric-sort-in-microsoft-sql-2005). – pascal