系统城装机大师 - 固镇县祥瑞电脑科技销售部宣传站!

当前位置:首页 > 数据库 > MsSql > 详细页面

sql server如何通过排序控制insert into ... select ... 语句的记录插入顺序

时间:2020-05-21来源:电脑系统城作者:电脑系统城

脚本:

复制代码
/*
    说明: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
复制代码

脚本运行结果:

分享到:

相关信息

系统教程栏目

栏目热门教程

人气教程排行

站长推荐

热门系统下载