腳本: /* 說明:sql server如何通過排序控制insert into ... select ... 語句的記錄插入順序 腳本來源:https://www.cnblogs.com/zhang502219048/p/12925890.html */ create table #t ( id i ...
腳本:
/* 說明:sql server如何通過排序控制insert into ... select ... 語句的記錄插入順序 腳本來源:https://www.cnblogs.com/zhang502219048/p/12925890.html */ create table #t ( id int identity(1,1), name nvarchar(50) ) insert into #t select * from ( select 'A' name union select 'C' union select 'B' ) a order by name desc select * from #t drop table #t
腳本運行結果:
【轉載請註明博文來源:https://www.cnblogs.com/zhang502219048/p/12925890.html】