create proc sp_SearchProductList
(
@startRowIndex int, --起始行号
@maximumRows int, --最大行数(每页记录条数)
@productName nvarchar(20)  --新闻类别
)
as 
begin
with temp as 
(select row_number() over(order by productID desc) as rowIndex,* from v_products where (productName like '%' + @productName + '%') --这里有错.请问这句该怎么写呢?就是where后面的括号里的
select * from temp where rowIndex between @startRowIndex and @startRowIndex+@maximumRows-1
end
go

解决方案 »

  1.   

    create proc sp_SearchProductList
    (
        @startRowIndex int,    --起始行号
        @maximumRows int,    --最大行数(每页记录条数)
        @productName nvarchar(20)  --新闻类别
    )
    as 
    begin
        with temp as 
        (select row_number() over(order by productID desc) as rowIndex,* from v_products where (productName like '%' + @productName + '%')) --这里有错.请问这句该怎么写呢?就是where后面的括号里的
        select * from temp where rowIndex between @startRowIndex and @startRowIndex+@maximumRows-1
    end
    go