When running GP Utilities for the year-end tax updates (11.0.1860), we get the below error when updating the company database. It appears the the first part of the SQL statement got cut off or a closing parens was otherwise placed at the start of the SQL statement. I’ve looked through the update documentation and can’t seem to find anything on this error. It appears to occur on the Load Stored Procedures step at svcValidateServiceSubcontractorLines.
The following SQL statement produced an error:
) select RcptApply.ITEMNMBR as Item, sum(round(RcptApply.QTYINVCD * RcptApply.UMQTYINB, LineHist.DECPLQTY - 1)) , '' as Filter from POP30310 as LineHist with (NOLOCK), POP10500 as RcptApply with (NOLOCK) where (RcptApply.Status = 1) and (RcptApply.DATERECD >= @I_dUserDate - @I_iPeriodDays and RcptApply.DATERECD <= @I_dUserDate - 1) and (RcptApply.POPRCTNM = LineHist.POPRCTNM and RcptApply.RCPTLNNM = LineHist.RCPTLNNM) and (RcptApply.QTYINVCD > 0) and (RcptApply.POPTYPE = 2) and (exists (select * from POP10100 as POWork where (RcptApply.PONUMBER <> '' and RcptApply.PONUMBER = POWork.PONUMBER and (POWork.POTYPE = 2 or POWork.POTYPE = 4))) or exists ( select * from POP30100 as POHist where (RcptApply.PONUMBER <> '' and RcptApply.PONUMBER = POHist.PONUMBER and (POHist.POTYPE = 2 or POHist.POTYPE = 4)))) group by RcptApply.ITEMNMBR end else begin if @Buyer <> '' begin insert #ItemQtys (ITEMNMBR, QTYSHPPD, Filter) select RcptApply.ITEMNMBR as Item, sum(round(RcptApply.QTYSHPPD * RcptApply.UMQTYINB, LineHist.DECPLQTY - 1)), BUYERID as Filter from POP30310 as LineHist with (NOLOCK), POP10500 as RcptApply with (NOLOCK), POP10100 as POWork with (NOLOCK) where (RcptApply.Status = 1) and (RcptApply.DATERECD >= @I_dUserDate - @I_iPeriodDays and RcptApply.DATERECD <= @I_dUserDate - 1) and (RcptApply.POPRCTNM = LineHist.POPRCTNM and RcptApply.RCPTLNNM = LineHist.RCPTLNNM) and (RcptApply.QTYSHPPD > 0) and (RcptApply.POPTYPE = 1 or RcptApply.POPTYPE = 3) and RcptApply.PONUMBER <> '' and RcptApply.PONUMBER = POWork.PONUMBER and (POWork.POTYPE = 1 or POWork.POTYPE = 3) group by RcptApply.ITEMNMBR, BUYERID insert #ItemQtys (ITEMNMBR, QTYSHPPD, Filter) select RcptApply.ITEMNMBR as Item, sum(round(RcptApply.QTYSHPPD * RcptApply.UMQTYINB, LineHist.DECPLQTY - 1)), BUYERID as Filter from POP30310 as LineHist with (NOLOCK), POP10500 as RcptApply with (NOLOCK), POP30100 as POHist with (NOLOCK) where (RcptApply.Status = 1) and (RcptApply.DATERECD >= @I_dUserDate - @I_iPeriodDays and RcptApply.DATERECD <= @I_dUserDate - 1) and (RcptApply.POPRCTNM = LineHist.POPRCTNM and RcptApply.RCPTLNNM = LineHist.RCPTLNNM) and (RcptApply.QTYSHPPD > 0) and (RcptApply.POPTYPE = 1 or RcptApply.POPTYPE = 3) and RcptApply.PONUMBER <> '' and RcptApply.PONUMBER = POHist.PONUMBER and (POHist.POTYPE = 1 or POHist.POTYPE = 3) group by RcptApply.ITEMNMBR, BUYERID insert #ItemQtys (ITEMNMBR, QTYSHPPD, Filter) select RcptApply.ITEMNMBR as Item, sum(round(RcptApply.QTYINVCD * RcptApply.UMQTYINB, LineHist.DECPLQTY - 1)) , BUYERID as Filter from POP30310 as LineHist with (NOLOCK), POP10500 as RcptApply with (NOLOCK), POP10100 as POWork with (NOLOCK) where (RcptApply.Status = 1) and (RcptApply.DATERECD >= @I_dUserDate - @I_iPeriodDays and RcptApply.DATERECD <= @I_dUserDate - 1) and (RcptApply.POPRCTNM = LineHist.POPRCTNM and RcptApply.RCPTLNNM = LineHist.RCPTLNNM) and (RcptApply.QTYINVCD > 0) and (RcptApply.POPTYPE = 2) and RcptApply.PONUMBER <> '' and RcptApply.PONUMBER = POWork.PONUMBER and (POWork.POTYPE = 2 or POWork.POTYPE = 4) group by RcptApply.ITEMNMBR, BUYERID insert #ItemQtys (ITEMNMBR, QTYSHPPD, Filter) select RcptApply.ITEMNMBR as Item, sum(round(RcptApply.QTYINVCD * RcptApply.UMQTYINB, LineHist.DECPLQTY - 1)) , BUYERID as Filter from POP30310 as LineHist with (NOLOCK), POP10500 as RcptApply with (NOLOCK), POP30100 as POHIST with (NOLOCK) where (RcptApply.Status = 1) and (RcptApply.DATERECD >= @I_dUserDate - @I_iPeriodDays and RcptApply.DATERECD <= @I_dUserDate - 1) and (RcptApply.POPRCTNM = LineHist.POPRCTNM and RcptApply.RCPTLNNM = LineHist.RCPTLNNM) and (RcptApply.QTYINVCD > 0) and (RcptApply.POPTYPE = 2) and RcptApply.PONUMBER <> '' and RcptApply.PONUMBER = POHIST.PONUMBER and (POHIST.POTYPE = 2 or POHIST.POTYPE = 4) group by RcptApply.ITEMNMBR, BUYERID end else if @Vendor <> '' begin insert #ItemQtys (ITEMNMBR, QTYSHPPD, Filter) select RcptApply.ITEMNMBR as Item, sum(round(RcptApply.QTYSHPPD * RcptApply.UMQTYINB, LineHist.DECPLQTY - 1)), POWork.VENDORID as Filter from POP30310 as LineHist with (NOLOCK), POP10500 as RcptApply with (NOLOCK), POP10100 as POWork with (NOLOCK) where (RcptApply.Status = 1) and (RcptApply.DATERECD >= @I_dUserDate - @I_iPeriodDays and RcptApply.DATERECD <= @I_dUserDate - 1) and (RcptApply.POPRCTNM = LineHist.POPRCTNM and RcptApply.RCPTLNNM = LineHist.RCPTLNNM) and (RcptApply.QTYSHPPD > 0) and (RcptApply.POPTYPE = 1 or RcptApply.POPTYPE = 3) and RcptApply.PONUMBER <> '' and RcptApply.PONUMBER = POWork.PONUMBER and (POWork.POTYPE = 1 or POWork.POTYPE = 3) group by RcptApply.ITEMNMBR, POWork.VENDORID insert #ItemQtys (ITEMNMBR, QTYSHPPD, Filter) select RcptApply.ITEMNMBR as Item, sum(round(RcptApply.QTYSHPPD * RcptApply.UMQTYINB, LineHist.DECPLQTY - 1)), POHist.VENDORID as Filter from POP30310 as LineHist with (NOLOCK), POP10500 as RcptApply with (NOLOCK), POP30100 as POHist with (NOLOCK) where (RcptApply.Status = 1) and (RcptApply.DATERECD >= @I_dUserDate - @I_iPeriodDays and RcptApply.DATERECD <= @I_dUserDate - 1) and (RcptApply.POPRCTNM = LineHist.POPRCTNM and RcptApply.RCPTLNNM = LineHist.RCPTLNNM) and (RcptApply.QTYSHPPD > 0) and (RcptApply.POPTYPE = 1 or RcptApply.POPTYPE = 3) and RcptApply.PONUMBER <> '' and RcptApply.PONUMBER = POHist.PONUMBER and (POHist.POTYPE = 1 or POHist.POTYPE = 3) group by RcptApply.ITEMNMBR, POHist.VENDORID insert #ItemQtys (ITEMNMBR, QTYSHPPD, Filter) select RcptApply.ITEMNMBR as Item, sum(round(RcptApply.QTYINVCD * RcptApply.UMQTYINB, LineHist.DECPLQTY - 1)) , POWork.VENDORID as Filter from POP30310 as LineHist with (NOLOCK), POP10500 as RcptApply with (NOLOCK), POP10100 as POWork with (NOLOCK) where (RcptApply.Status = 1) and (RcptApply.DATERECD >= @I_dUserDate - @I_iPeriodDays and RcptApply.DATERECD <= @I_dUserDate - 1) and (RcptApply.POPRCTNM = LineHist.POPRCTNM and RcptApply.RCPTLNNM = LineHist.RCPTLNNM) and (RcptApply.QTYINVCD > 0) and (RcptApply.POPTYPE = 2) and RcptApply.PONUMBER <> '' and RcptApply.PONUMBER = POWork.PONUMBER and (POWork.POTYPE = 2 or POWork.POTYPE = 4) group by RcptApply.ITEMNMBR, POWork.VENDORID insert #ItemQtys (ITEMNMBR, QTYSHPPD, Filter) select RcptApply.ITEMNMBR as Item, sum(round(RcptApply.QTYINVCD * RcptApply.UMQTYINB, LineHist.DECPLQTY - 1)) , POHIST.VENDORID as Filter from POP30310 as LineHist with (NOLOCK), POP10500 as RcptApply with (NOLOCK), POP30100 as POHIST with (NOLOCK) where (RcptApply.Status = 1) and (RcptApply.DATERECD >= @I_dUserDate - @I_iPeriodDays and RcptApply.DATERECD <= @I_dUserDate - 1) and (RcptApply.POPRCTNM = LineHist.POPRCTNM and RcptApply.RCPTLNNM = LineHist.RCPTLNNM) and (RcptApply.QTYINVCD > 0) and (RcptApply.POPTYPE = 2) and RcptApply.PONUMBER <> '' and RcptApply.PONUMBER = POHIST.PONUMBER and (POHIST.POTYPE = 2 or POHIST.POTYPE = 4) group by RcptApply.ITEMNMBR, POHIST.VENDORID end else begin insert #ItemQtys (ITEMNMBR, QTYSHPPD, Filter) select RcptApply.ITEMNMBR as Item, sum(round(RcptApply.QTYSHPPD * RcptApply.UMQTYINB, LineHist.DECPLQTY - 1)), RcptApply.ITEMNMBR as Filter from POP30310 as LineHist with (NOLOCK), POP10500 as RcptApply with (NOLOCK), POP10100 as POWork with (NOLOCK) where (RcptApply.Status = 1) and (RcptApply.DATERECD >= @I_dUserDate - @I_iPeriodDays and RcptApply.DATERECD <= @I_dUserDate - 1) and (RcptApply.POPRCTNM = LineHist.POPRCTNM and RcptApply.RCPTLNNM = LineHist.RCPTLNNM) and (RcptApply.QTYSHPPD > 0) and (RcptApply.POPTYPE = 1 or RcptApply.POPTYPE = 3) and RcptApply.PONUMBER <> '' and RcptApply.PONUMBER = POWork.PONUMBER and (POWork.POTYPE = 1 or POWork.POTYPE = 3) group by RcptApply.ITEMNMBR, LineHist.ITEMNMBR insert #ItemQtys (ITEMNMBR, QTYSHPPD, Filter) select RcptApply.ITEMNMBR as Item, sum(round(RcptApply.QTYSHPPD * RcptApply.UMQTYINB, LineHist.DECPLQTY - 1)), RcptApply.ITEMNMBR as Filter from POP30310 as LineHist with (NOLOCK), POP10500 as RcptApply with (NOLOCK), POP30100 as POHist with (NOLOCK) where (RcptApply.Status = 1) and (RcptApply.DATERECD >= @I_dUserDate - @I_iPeriodDays and RcptApply.DATERECD <= @I_dUserDate - 1) and (RcptApply.POPRCTNM = LineHist.POPRCTNM and RcptApply.RCPTLNNM = LineHist.RCPTLNNM) and (RcptApply.QTYSHPPD > 0) and (RcptApply.POPTYPE = 1 or RcptApply.POPTYPE = 3) and RcptApply.PONUMBER <> '' and RcptApply.PONUMBER = POHist.PONUMBER and (POHist.POTYPE = 1 or POHist.POTYPE = 3) group by RcptApply.ITEMNMBR, RcptApply.ITEMNMBR insert #ItemQtys (ITEMNMBR, QTYSHPPD, Filter) select RcptApply.ITEMNMBR as Item, sum(round(RcptApply.QTYINVCD * RcptApply.UMQTYINB, LineHist.DECPLQTY - 1)) , RcptApply.ITEMNMBR as Filter from POP30310 as LineHist with (NOLOCK), POP10500 as RcptApply with (NOLOCK), POP10100 as POWork with (NOLOCK) where (RcptApply.Status = 1) and (RcptApply.DATERECD >= @I_dUserDate - @I_iPeriodDays and RcptApply.DATERECD <= @I_dUserDate - 1) and (RcptApply.POPRCTNM = LineHist.POPRCTNM and RcptApply.RCPTLNNM = LineHist.RCPTLNNM) and (RcptApply.QTYINVCD > 0) and (RcptApply.POPTYPE = 2) and RcptApply.PONUMBER <> '' and RcptApply.PONUMBER = POWork.PONUMBER and (POWork.POTYPE = 2 or POWork.POTYPE = 4) group by RcptApply.ITEMNMBR, RcptApply.ITEMNMBR insert #ItemQtys (ITEMNMBR, QTYSHPPD, Filter) select RcptApply.ITEMNMBR as Item, sum(round(RcptApply.QTYINVCD * RcptApply.UMQTYINB, LineHist.DECPLQTY - 1)) , RcptApply.ITEMNMBR as Filter from POP30310 as LineHist with (NOLOCK), POP10500 as RcptApply with (NOLOCK), POP30100 as POHIST with (NOLOCK) where (RcptApply.Status = 1) and (RcptApply.DATERECD >= @I_dUserDate - @I_iPeriodDays and RcptApply.DATERECD <= @I_dUserDate - 1) and (RcptApply.POPRCTNM = LineHist.POPRCTNM and RcptApply.RCPTLNNM = LineHist.RCPTLNNM) and (RcptApply.QTYINVCD > 0) and (RcptApply.POPTYPE = 2) and RcptApply.PONUMBER <> '' and RcptApply.PONUMBER = POHIST.PONUMBER and (POHIST.POTYPE = 2 or POHIST.POTYPE = 4) group by RcptApply.ITEMNMBR, RcptApply.ITEMNMBR end end if @Buyer = '' and @Vendor = '' and @ItemNumber = '' begin select top (select @I_iNumItems) sum(ItemQtys.QTYSHPPD) as QtyShipInv, ItemQtys.ITEMNMBR as ItemNumber, Filter from #ItemQtys as ItemQtys group by ItemQtys.ITEMNMBR, Filter order by QtyShipInv DESC, ItemNumber, Filter end else begin select sum(ItemQtys.QTYSHPPD) as QtyShipInv, ItemQtys.ITEMNMBR as ItemNumber, Filter from #ItemQtys as ItemQtys inner join (select top (select @I_iNumItems) sum(ItemQtys.QTYSHPPD) as QtyShipInv, ItemQtys.ITEMNMBR as ItemNumber from #ItemQtys as ItemQtys group by ItemQtys.ITEMNMBR order by QtyShipInv DESC, ItemNumber) ItemsList on ItemQtys.ITEMNMBR = ItemsList.ItemNumber inner join @ValuesTable FilterList on FilterList.Value = ItemQtys.Filter group by ItemQtys.ITEMNMBR, Filter order by QtyShipInv DESC, ItemNumber, Filter end drop table #ItemQtys
ERROR [Microsoft][SQL Server Native Client 10.0][SQL Server]Incorrect syntax near ')'.
*This post is locked for comments