create table testTop

(
 value int primary key
)

–可以一次插入顶部的多条记录

insert top(5) into testTop 
select *
from (select 1 as value union select 2 union select 3 union select 4
   union select 5 union select 6 union select 7) as sevenRows
go 

 

select * from testTop

update top(2) testTop

set value=value * 100 delete top(3) testTop

 

–可以动态设定top的参数

declare @rowsToReturn int
select  @rowsToReturn=10
select Top(@rowsToReturn) *
from HumanResources.Employee

版权声明:本文为djcsch2001原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/djcsch2001/archive/2012/11/11/2764881.html