用了微软的那个游标查询后出的问题!!
CREATE PROCEDURE sp_mypager(@sqlstr nvarchar(4000),@Pagecount int, @pagesize int )
-- @slqstr :查询字符串
-- @pagecount 第N 页
--@ pggesize 每页行数
as
set nocount on
declare @P1 int,--P1是游标的id
@rowcount int
exec sp_cursoropen @P1 output,@sqlstr,@scrollopt=1,@ccopt=1,@rowcount=@rowcount output
select @rowcount as 总行数,ceiling(1.0*@rowcount/@pagesize) as 页数,@pagecount as 当前页
set @pagecount=(@pagecount-1)*@pagesize+1
exec sp_cursorfetch @P1,16,@pagecount,@pagesize
exec sp_cursorclose @P1
GO
----------------------------------
exec sp_mypager "select * from Sales_DomainHost,ClientList where ClientList.ClientId=Sales_DomainHost.ClientId AND Sales_DomainHost.ProviderProductId=71 ",1,20
错误提示是
以 'select * from Sales_DomainHost,ClientList where ClientList.ClientId=Sales_DomainHost.ClientId AND Sales_DomainHost.ProviderProdu ' 开头的 标识符 太长。最大长度为 128。
------解决方案----------------------try
exec sp_mypager 'select * from Sales_DomainHost,ClientList where ClientList.ClientId=Sales_DomainHost.ClientId AND Sales_DomainHost.ProviderProductId=71 ',1,20