读书人

存储过程 实施出错#183;求大师解答

发布时间: 2012-09-06 10:37:01 作者: rapoo

存储过程 执行出错·求大师解答

SQL code
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


`````报SELECT附近有语法错误


[解决办法]
SQL code
         img4Small, img1, img2, img3,img4, img1Big, img2Big, img3Big, img4Big,  graphPaper_3D,        graphPaper_CAD,graphPaper_PDF from VD_product 

读书人网 >asp.net

热点推荐