日期:2014-05-18 浏览次数:20448 次
IF EXISTS (SELECT 1 FROM SYSOBJECTS WHERE name = 'TBC') BEGIN DROP TABLE TBC END GO CREATE TABLE TBC ( louhao VARCHAR(100) ) INSERT INTO TBC SELECT '1号楼' UNION SELECT '3号楼' UNION SELECT '2号楼' UNION SELECT '4号楼' UNION SELECT '6号楼' UNION SELECT '5号楼' UNION SELECT '8号楼' UNION SELECT '7号楼' UNION SELECT '9号楼' UNION SELECT '10号楼' UNION SELECT '12号楼' UNION SELECT '11号楼' SELECT louhao FROM TBC ORDER BY CAST(LEFT(louhao,CHARINDEX('号',louhao) - 1) AS INT) louhao 1号楼 2号楼 3号楼 4号楼 5号楼 6号楼 7号楼 8号楼 9号楼 10号楼 11号楼 12号楼