SQL SERVER 2008的top增强
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