脚本:
/* 说明: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】