Warning: Undefined array key "HTTP_REFERER" in /www/wwwroot/prod/www.enjoyasp.net/wp-content/plugins/google-highlight/google-hilite.php on line 58
declare @i int
set @i=1
select top @i, * from table1
在存储过程中得不到执行,因为top时后面只能是常量。
可用:
declare @i int
set @i=1
set rowcount @i
select * from table1
set rowcount = 0
rowcount:指定查询返回的记录条数,使命令的处理在响应指定的行数之后停止处理命令
set rowcount @i
select * from table1 相当于 select top 1 from table1
set rowcount = 0 取消指定