Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8338

Parameter not accepted in Query Generator

$
0
0

Dear Experts,

  i had tried customer aging report. it's working fine without parameter (m5.lastname = [0%]) but client needs parameter.  I'm badly stuck with following error

 

1). [Microsoft][SQL Server Native Client 10.0][SQL Server]Must specify table to select from. 2). [Microsoft][SQL Server Native Client 10.0][SQL Server]Statement 'Blanket Agreement' (OOAT) (s) could not be prepared.

 

My query as below

 

SELECT  M2.cardcode 'Customer Code', M2.cardname 'Customer Name', M4.U_salManNm, m2.U_BeatCode, m4. U_salManNm,

case l.transtype

when '13' then 'INV'

when '14' then 'AR CN'

when '24' then 'INCOMING'

WHEN '30' THEN 'J.E'

else 'Other'

end 'Type',

  1. j.BaseRef AS 'Doc.No',
  2. l.LineMemo AS 'Remarks',

CONVERT(VARCHAR(10), l.refdate, 103)'Posting Date' ,

CONVERT(VARCHAR(10), l.duedate, 103) 'Due Date',

case when ((datediff(dd,l.refdate,current_timestamp))+1 > 30

and (datediff(dd,l.refdate,current_timestamp))+1< 61)

then

case

when BalDueCred <> 0 then BalDueCred * - 1

else BalDueDeb

end

end "30-61 Days",

 

case when ((datediff(dd,l.refdate,current_timestamp))+1 > 60

and (datediff(dd,l.refdate,current_timestamp))+1< 91)

then

case

when BalDueCred <> 0 then BalDueCred * - 1

else BalDueDeb

end

end "61-90 Days",

 

case when ((datediff(dd,l.refdate,current_timestamp))+1 > 90

and (datediff(dd,l.refdate,current_timestamp))+1< 121)

then

case

when BalDueCred <> 0 then BalDueCred * - 1

else BalDueDeb

end

end "91-120 Days",

 

case when ((datediff(dd,l.refdate,current_timestamp))+1 > 120

and (datediff(dd,l.refdate,current_timestamp))+1< 181)

then

case

when BalDueCred <> 0 then BalDueCred * - 1

else BalDueDeb

end

end "120-180 Days",

case when ((datediff(dd,l.refdate,current_timestamp))+1 > 180

and (datediff(dd,l.refdate,current_timestamp))+1< 221)

then

case

when BalDueCred <> 0 then BalDueCred * - 1

else BalDueDeb

end

end "180-220 Days",

CASE

when (DATEDIFF(dd,l.refdate,current_timestamp))+1 > 220

then

case

when BalDueCred= 0 then BalDueDeb

when BalDueDeb= 0 then BalDueCred * - 1

end

end "221 + Days"

FROM JDT1 l

INNER JOIN OJDT j On j.TransId=l.TransId

LEFT OUTER JOIN OCRD M2 ON M2.cardcode= l.shortname inner join dbo.[@CQ_RTSM] m4 on m2.U_BeatCode=m4.U_RoutCode inner join ohem m5 on m5.lastname = m4. U_salManNm

WHERE l.[BalDueDeb]!='0.00' AND  m5.lastName=[%0] and

M2.cardtype= 'C'

AND

  1. l.intrnmatch= '0'

ORDER BY

M2.CardCode, l.taxdate


Viewing all articles
Browse latest Browse all 8338

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>