July 1, 2011 at 3:18 am
select @sCriteria=substring(@Criteria,charindex('sl.CreatedDate>=',@Criteria),79)
select @sCriterialist=REPLACE (@Criteria,@sCriteria,'1=1')
SELECT sl.[ReferenceListNumber] AS [ListNumber],
sl. [CreatedDate],
sl.[TransactionTypeName] AS ListTypeName,
sl.[FromToBusinessUnitCode] AS [VendorBusinessUnitCode] ,
sl.[FromToBusinessUnitName] AS [VendorBusinessUnitName] ,
sl.[OrderNumber] AS [ReferenceListNumber],
sl.[ShipmentNumber], sl.InvoiceNumber,
sl.[BusinessUnitCode] AS WarehouseCode,
sl.[BusinessUnitName] AS WarehouseName,
sl.Price AS StandardCost,
sl.InwardQty AS InwardQuantity,
sl.OutwardQty AS OutwardQuantity,
sl.CurrentStockQty AS Balance,
sl.ArticleSKU,
dzaARTICLE.BrandCode,
sl.OpeningStock,
sl. ArticleCode, sl.ArticleName,
null,sl.SizeCode as [Size] ,
sl.CurrentStockValue,
sl.SortOrder ,
sl.ArticleBarCode,
dzaARTICLE.UOMCode,
dzaARTICLE. ListPriceCurrencyCode,
null AS FinalStockQty ,sl. ArticleID,
(select POSSlipStatus From POSSlip where POSSlipNumber=sl.[ReferenceListNumber])as POSSlipStatus,
ROW_NUMBER() OVER(PARTITION BY sl.ArticleSKU ORDER BY sl.CreatedDate DESC) AS Count1
FROM [StockLog] sl left join dzaARTICLE(NOLOCK) on dzaARTICLE.ArticleID=sl.ArticleID
Where '+@sCriterialist+' order by sl.CreatedDate DESC '
When I am execute this store procedure
exec axspRSTOCKLEDGERREPORT @Isparam=1,@Criteria=N'(sl.BusinessUnitcode=''AXIND'' and dzaARTICLE.ArticleSubCatCode=''1EBAUP'' and sl.ArticleCode in (''3151--R'') and sl.CreatedDate>=''01-Jul-11 00:00:00'' and sl.CreatedDate<=''31-Jul-11 23:59:59'' and dzaARTICLE.BrandCode=''nike2'' )'
in this way then this workin fine but
when we execute exec axspRSTOCKLEDGERREPORT @Isparam=1,@Criteria=N'(sl.BusinessUnitcode=''AXIND'' and sl.CreatedDate>=''01-Jun-11 00:00:00'' and sl.CreatedDate<=''30-Jun-11 23:59:59'' )' this then its showing Msg 537, Level 16, State 3, Procedure axspRSTOCKLEDGERREPORT, Line 155
Invalid length parameter passed to the LEFT or SUBSTRING function.
this error msg
please any one halp me
namrata
July 1, 2011 at 4:18 am
Just go to the Line 155 of Procedure axspRSTOCKLEDGERREPORT as indicated by the error message.
Somewhere in that area is either a LEFT or SUBSTRING function (also mentioned in the error message).
Analyze the values being part of the function and check if the the length parameter returns a negative value.
July 1, 2011 at 6:09 am
Thanks I am finding the solution this problem
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply