当前位置: 代码迷 >> ASP.NET >> 存储过程 实施出错·求大师解答
  详细解决方案

存储过程 实施出错·求大师解答

热度:1177   发布时间:2013-02-25 00:00:00.0
存储过程 执行出错·求大师解答
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
  相关解决方案