-- Test Data: ta IF OBJECT_ID('[ta]') IS NOT NULL DROP TABLE [ta] Go CREATE TABLE ta([姓名] NVARCHAR(2)) Go INSERT INTO ta SELECT '张三' UNION ALL SELECT '李四' UNION ALL SELECT '王五' UNION ALL SELECT '张思' GO --Start SELECT * into newtable FROM TA order by [姓名]select * from newtable ; drop table newtable--Result: /*姓名 ---- 李四 王五 张三 张思(4 行受影响) */ --End
select * into newtalbe from ta order by name 这个的结果和 select * from newtalbe 他的结果不一样。 newtalbe 中的内容还是没排序。
order by [姓名],[性别] 就不行了
15L其实是对的聚集索引 create clustered index IX_表a_姓名 on 表a (姓名 asc)没聚集索引姓名不可能有序的,插入1条新纪录就乱了。
into newtalbe
from ta
order by name
IF OBJECT_ID('[ta]') IS NOT NULL
DROP TABLE [ta]
Go
CREATE TABLE ta([姓名] NVARCHAR(2))
Go
INSERT INTO ta
SELECT '张三' UNION ALL
SELECT '李四' UNION ALL
SELECT '王五' UNION ALL
SELECT '张思'
GO
--Start
SELECT
* into newtable
FROM
TA
order by [姓名]select * from newtable
;
drop table newtable--Result:
/*姓名
----
李四
王五
张三
张思(4 行受影响)
*/
--End
into newtalbe
from ta
order by name
这个的结果和
select * from newtalbe 他的结果不一样。
newtalbe 中的内容还是没排序。
order by [姓名],[性别]
就不行了
create clustered index IX_表a_姓名 on 表a (姓名 asc)没聚集索引姓名不可能有序的,插入1条新纪录就乱了。