Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Query error

If I execute this in DB A, it shows no value, but if i execute it in DB B, it shows error like

Msg 537, Level 16, State 3, Line 1

Invalid length parameter passed to the LEFT or SUBSTRING function.

Why error message is coming in DB B ?

SELECT distinct (sum(T1.Debit-T1.Credit)*-1),T0.Segment_1,substring(Acctname,1,len(acctname)-7)FROM OACT T0 INNER JOIN JDT1 T1 ON T0.AcctCode = T1.Account WHERE T1.[RefDate] >='2009-4-1 00:00:00.000' and T1.[RefDate] <='2010-3-31 00:00:00.000' and (Fathernum='5210900000'or Fathernum='5210800000'or FatherNum ='5210100000'or FatherNum = '5210200000'or FatherNum = '5210300000'or FatherNum ='5210400000'or FatherNum = '5210500000'or FatherNum = '5210600000'or FatherNum = '5210700000')and (substring(Acctname,1,len(acctname)-7)='" & objmatrix.Columns.Item("1").Cells.Item(a).Specific.value & "' or substring(Acctname,1,len(acctname)-8)='" & objmatrix.Columns.Item("1").Cells.Item(a).Specific.value & "') group by T0.Segment_1 , substring(Acctname,1,len(acctname)-7)

Former Member
Not what you were looking for? View more on this topic or Ask a question