create table t1
(
id int,
s1 int
)
Declare @i int
set @i=1
while(@i<200000)
begin
insert into t1 values(@i+1,@i)
set @i=@i+1
end
select t.id,t.s1,t.pos from
(
select *,row_number() over (order by s1 desc) as pos from t1
) as t
where t.pos >= 1 and t.pos <= 10
本文介绍了一种使用T-SQL在SQL Server中进行大量数据批量插入的方法,并展示了如何通过窗口函数ROW_NUMBER()实现对特定字段进行降序排列后的TOP 10排名查询。
1172

被折叠的 条评论
为什么被折叠?



