--分页
create proc sel_fen
@tablename varchar(20),--表名
@pk varchar(20),--主键
@pagesize int=10,--每页多少条数据
@pagenumber int=1--当前页
as
begin
select top (@pagesize) * from @tablename where @pk not in ( select top ((@pagenumber-1)[email protected]) @pk from prc_sp)
end
谁能帮我看看为什么老是说我变量未申明?
------解决方案--------------------
- SQL code
EXEC('select top ([email protected]+') * from [email protected]+' where [email protected]+' not in ( select top (([email protected]+')[email protected]+') [email protected]+' from prc_sp)')
------解决方案--------------------
要用动态语句