创建万能分页

--创建万能分页
alter proc wannengfenye11
@nowye int,
@numbers int,
@tablename varchar(50),
@zhujian varchar(50)
as
必须要用字符串连接起来,不然系统识别不出@tablename
exec
('select top('+@numbers+') *from'+@tablename+'where'+@zhujian+'not in (select top (('+@nowye+'-1)*'+@numbers+') '+@zhujian+' from'+ @tablename+')') go exec wannengfenye11 2,2,' student ',' sno '

 

posted @ 2015-04-28 10:43  XCml  阅读(149)  评论(0编辑  收藏  举报