SQL 查询结果保存为 临时表
-- 1. 在使用select into前,可以先做一下判断 if OBJECT_ID('tempdb..#TT')is not NULL drop table #TT -- 2. 查询结果保存为临时表 SELECT * INTO #TT FROM ( SELECT * FROM fkcData0919 ) AS aaa ORDER BY [乡(镇)] +[村] -- 3. 查询临时表 SELECT * FROM #TT -- 4. 删除原始表 TRUNCATE TABLE fkcData0919 -- 5. 临时表保存到原始表中 INSERT INTO fkcData0919 SELECT * FROM #TT ORDER BY [乡(镇)] +[村] -- 6. 查询原始表 SELECT * FROM fkcData0919