SQL分页问题。我急请各位大哥帮帮我啊。
ALTER PROCEDURE GetProductByCategory
(
@categoryId int,
@pageSize int,
@pageIndex int
)
AS
DECLARE @sql nvarchar(4000)
SET @sql = 'select top'+cast(@pagesize as varchar(20))+'* from ProductInfo
where CategoryId= '+cast(@categoryId as varchar(20))+'
and ProductInfo.ProductId not in (select top '+cast((@pageSize*@pageindex) as varchar(20))
+ 'ProductId from ProductInfo where CategoryId ='
+cast(@categoryId as varchar(20))+'order by productId) order by productId'
EXEC sp_ExecuteSql @sql
这里分页的代码,
为什么在网页中会出现错误,提示:from附近有错误。
我急请各位大哥帮帮我啊。