emp 1000 emp 23 emp 33
emp23 emp33 emp1000
DECLARE @Table TABLE (ID VARCHAR(30)) INSERT @Table SELECT 'emp1000' UNION ALL SELECT 'emp23' UNION ALL SELECT 'emp33' SELECT ID FROM @Table ORDER BY SPACE(50 - LEN(ID))+ ID ASC
SELECT ID, 'emp'+ID AS EmpID FROM TableName ORDER BY ID
select employeename from tablename order by len(employeename), employeename asc
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)