Query Processor could not produce a query plan

  • Hi,

    In need of some help here. I have an SQL code in SQL 2000 as follows:

     

    SELECT  ALSUM.ACCTNUM,ALSUM.ENTITYID,ALSUM.PERIOD,ALSUM.BALFOR,SUM(ALSUM.ACTIVITY) FROM ALSUM WHERE ((ACCTNUM>='1111' AND ACCTNUM<='9999')) AND BASIS='A' AND PERIOD>='200701' AND PERIOD<='200708' AND ENTITYID IN (('A','B') AND DEPARTMENT='1' GROUP BY ACCTNUM, ENTITYID,PERIOD,BALFOR UNION ALL SELECT ALSUM_RT.ACCTNUM,ALSUM_RT.ENTITYID,ALSUM_RT.PERIOD,ALSUM_RT.BALFOR, SUM(ALSUM_RT.ACTIVITY) FROM ALSUM_RT WHERE TASKID=1 AND ((ACCTNUM>='1111' AND ACCTNUM <='9999')) AND BASIS='B' AND PERIOD>='200701' AND PERIOD<='200708' AND ENTITYID IN ('A','B') AND DEPARTMENT='1' GROUP BY ACCTNUM,ENTITYID,PERIOD,BALFOR ORDER BY 1,2,3,4

    By running this query, I encountered the error 8623:Internal Query Processor Error: The query processor could not produce a query plan.

    The strange thing is that this query has been working in the past. There is no changes to this query at all. Anyone has any idea how come it decides not to work?

    Something I found out is that eventually this query if executed will be an empty recordset. Any help is appreciated.

    Chee Hwee.

  • How is your statistics?

    You are missing a ) in the code above.

    SELECT      ACCTNUM,

                ENTITYID,

                PERIOD,

                BALFOR,

                SUM(ACTIVITY) AS ACTIVITY

    FROM        (

                            SELECT      ACCTNUM,

                                         ENTITYID,

                                         PERIOD,

                                         BALFOR,

                                         ACTIVITY

                            FROM        ALSUM

                            WHERE       ACCTNUM BETWEEN '1111' AND '9999'

                                         AND BASIS = 'A'

                                         AND PERIOD BETWEEN '200701' AND '200708'

                                         AND ENTITYID IN ('A', 'B')

                                         AND DEPARTMENT = '1'

     

                             UNION ALL

     

                             SELECT      ACCTNUM,

                                         ENTITYID,

                                         PERIOD,

                                         BALFOR,

                                         ACTIVITY

                             FROM        ALSUM_RT

                             WHERE       TASKID = 1

                                         AND ACCTNUM BETWEEN '1111' AND '9999'

                                         AND BASIS = 'B'

                                         AND PERIOD BETWEEN '200701' AND '200708'

                                         AND ENTITYID IN ('A', 'B')

                                         AND DEPARTMENT = '1'

                ) AS d

    GROUP BY    ACCTNUM,

                ENTITYID,

                PERIOD,

                BALFOR

    ORDER BY    ACCTNUM,

                ENTITYID,

                PERIOD,

                BALFOR

     


    N 56°04'39.16"
    E 12°55'05.25"

  • Hi Peter,

    Thanks for replying. I think I had a typo up there.

    Newbie here, what do you mean by statistics?

     

    Chee Hwee.

  • There seems to be a few scenarios that may produce this error text.

    http://support.microsoft.com/kb/896980 is one of them.

    If you google on Query Processor could not produce a query plan, you'll a few others as well.

    /Kenneth

  • I googled those as well... I got my server people to do the latest patching. What I m not certain of is why does this error occur now. If it is a service pack issue, shouldn't it fail in the very 1st time?

     

    Chee Hwee.

  • Well... maybe... But since it seems to be a bug, and also may be related to memory conditions, it's not certain that all the necessary conditions to provoke the bug is always present..

    /Kenneth

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply