Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Got an Error Unable to parse Query text

Author  Topic 

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2012-03-26 : 00:45:15
Hi Forumer's

I have 2 dataset from my SSRS report. when i create my second dataset
and run my query from SSRS query designer i got an error
"Unable to parse query text" kindly please help me guys to find out this error and what's wrong with my query. thanks in advance.


SELECT     r.CREATEDDATETIME AS CreatedDate, p.DELIVERYDATE AS ETADate, p.PURCHID AS PurchaseOrder, r.ORDERACCOUNT AS VendorAccount, 
p.ITEMID AS ItemNumber, p.NAME AS ItemName, p.QTYORDERED AS OrderQty, p.REMAINPURCHFINANCIAL AS RecvdQty,
p.REMAINPURCHPHYSICAL AS OpenQty, p.PURCHPRICE AS POUnitCost, p.LINEAMOUNT AS ExtPoCost, r.VENDORREF AS VendorReference,
r.INVENTLOCATIONID AS Location,
CASE WHEN r.vendorref LIKE '%Jan-Feb SB%' THEN 'JAN SB'
WHEN r.vendorref LIKE '%JAN SB%' THEN 'JAN SB'
WHEN r.vendorref LIKE '%Jan PO%' THEN 'JAN FC'
WHEN r.vendorref LIKE '%Feb FC%' THEN 'FEB FC'
WHEN r.vendorref LIKE '%Feb SB%' THEN 'FEB SB'
WHEN r.vendorref LIKE '%Mar SB%' OR r.vendorref LIKE '%Mar-Apr SB%' THEN 'MAR SB'
WHEN r.vendorref LIKE '%Mar BP%' THEN 'MAR FC'
WHEN r.vendorref LIKE '%March FC%' THEN 'MAR FC'
WHEN r.vendorref LIKE '%Mar PO%' THEN 'MAR FC' WHEN r.vendorref LIKE '%Mar FC%' THEN 'MAR FC'
WHEN r.vendorref LIKE '%APR FC%' THEN 'APR FC'
WHEN r.vendorref LIKE '%APR SB%' THEN 'APR SB'
WHEN r.vendorref LIKE '%APR BP%' THEN 'APR FC'
WHEN r.vendorref LIKE '%APR PO%' THEN 'APR FC'
WHEN r.vendorref LIKE '%April FC%' THEN 'APR FC'
WHEN r.vendorref LIKE '%May SB%' THEN 'MAY SB'
WHEN r.vendorref LIKE '%May FC%' THEN 'MAY FC'
WHEN r.vendorref LIKE '%Jun FC%' THEN 'JUN FC'
WHEN r.vendorref LIKE '%NOV%' THEN 'NOV FC' ELSE ' '
END AS ETAMonth
Into #Data2
FROM PURCHLINE AS p LEFT OUTER JOIN
PURCHTABLE AS r ON p.PURCHID = r.PURCHID
WHERE (r.CREATEDDATETIME <= @CreatedDatetime) AND (p.PURCHSTATUS = @Purchstatus) AND (r.PURCHPOOLID = @Purchpoolid) AND
(r.INVENTLOCATIONID IN (@inventlocationid))

Select
t.ItemNumber as SKU,
t.VendorAccount as Vendor,
t.ItemNumber+''+t.VendorAccount as SkuVendor,
JANSB=SUM(case when t.ETAMonth = 'JAN SB' Then t.OpenQty else 0 End),
JANFC=SUM(case when t.ETAMonth = 'JAN PO' Then t.OpenQty else 0 End),
FEBSB=SUM(case when t.ETAMonth = 'FEB SB' Then t.OpenQty else 0 End),
FEBFC=SUM(case when t.ETAMonth = 'FEB FC' Then t.OpenQty else 0 End),
MARSB=SUM(case when t.ETAMonth = 'MAR SB' Then t.OpenQty else 0 End),
MARFC=SUM(case when t.ETAMonth = 'MAR FC' or t.ETAMonth = 'MAR BP' OR t.ETAMonth = 'MAR PO' Then t.OpenQty else 0 End),
APRSB=SUM(case when t.ETAMonth = 'APR SB' Then t.OpenQty else 0 End),
APRFC=SUM(case when t.ETAMonth = 'APR FC' or t.ETAMonth = 'APR PO' Then t.OpenQty else 0 End),
MAYFC=SUM(case when t.ETAMonth = 'MAY FC' Then t.OpenQty else 0 End),
MAYSB=SUM(case when t.ETAMonth = 'MAY SB' Then t.OpenQty else 0 End),
JUNFC=SUM(case when t.ETAMonth = 'JUN FC' Then t.OpenQty else 0 End),
NOVFC=SUM(case when t.ETAMonth = 'NOV FC' Then t.OpenQty else 0 End)
From #Data2 t
Where t.ETAMonth is not null
and t.VendorAccount in ('AC8','RNP','WCS')
Group by t.ItemNumber, t.VendorAccount, t.ItemNumber+''+t.VendorAccount

Villanuev
Constraint Violating Yak Guru

478 Posts

Posted - 2012-03-26 : 01:51:53
No need to reply.. this is already solved.
Go to Top of Page
   

- Advertisement -