日期:2014-05-17 浏览次数:20396 次
ALTER procedure [dbo].[D_product_GetByPage] @pageindex int, @pagesize int, @productTypeId int, @breed nvarchar(50), @rows nvarchar(2000), @arctype int, @count int output as declare @sql nvarchar(1500) declare @sqlpage nvarchar(1500) declare @countsql nvarchar(1500) declare @searchsql nvarchar(1700) if @pageindex=0 set @pageindex=1 set @sql= ' select breed,did,buyprice,name,num,ProdectName '+@rows+', dbo.GetArctypeIdByProductId(did) as arctypeids,@productTypeId as productTypeId, ( SELECT dbo.Rtrim1((SELECT Rtrim(Ltrim(tag)) + '','' FROM D_ProTaxmapping WHERE pid = did FOR xml path(''''))) ) as tags, SeoTitle, Summary,Autoer,source,img1Small,img2Small,img3Small, img4Small, img1, img2, img3, img4, img1Big, img2Big, img3Big, img4Big, graphPaper_3D, graphPaper_CAD, graphPaper_PDF from VD_product where ((@breed='''' or @breed is null ) or breed like ''%''+@breed+''%'' ) and (producttypeid=@productTypeId) and (did in ( select distinct ProductId from [dbo].[D_productArcTypeMapping] where ArcTypeId=@arctype) or @arctype=0 ) ' set @sqlpage= ' order by did desc offset (@pageindex-1)*@pagesize row fetch next @pagesize rows only' set @countsql='select @count=count(1) from ('+@sql+' )t' set @searchsql=@sql+@sqlpage print @sql print @countsql exec sp_executesql @countsql,N'@count int output, @productTypeId int, @breed nvarchar(50),@arctype int',@count output,@productTypeId,@breed,@arctype exec sp_executesql @searchsql, N'@pageindex int,@pagesize int, @productTypeId int, @breed nvarchar(50),@arctype int',@pageindex,@pagesize,@productTypeId,@breed,@arctype
img4Small, img1, img2, img3,img4, img1Big, img2Big, img3Big, img4Big, graphPaper_3D, graphPaper_CAD,graphPaper_PDF from VD_product