List:MaxDB« Previous MessageNext Message »
From:Peter Willadt Date:April 6 2003 3:31pm
Subject:Re: Union in dbproc
View as plain text  
Hello,
On Sonntag, 6. April 2003 16:29, Brian Kavanaugh wrote:
> Microsoft OLE DB Provider for ODBC Drivers error '80004005'
> [SAP AG][SQLOD32 DLL][SAP DB]General error;-4024.
>
> However, SQL runs fine in SQL Studio. I'm running 7.3.0.29 and the 7.3 ODBC
> driver on Windows 2000. Any suggestions? The dbproc (stripped down to
> minimum fields; parameters aren't used in this section of the dbproc) is
> below:
>
[... Procedure here...]
please excuse me when I'm wrong and also please excuse when my remark is no 
direct solution to your question, but to me it appears as if the two queries 
that form the union are identical with the exception of the WHERE clause.
So you could probably build just one query and combine the two conditions with 
an OR in the where part. I guess it would also run faster than before.
So, the where part should look like this:

  WHERE
     tblCalendar.isApproved = true AND
     ((DATE <= tblCalendarDtl.EventDate AND
       DATEDIFF( DATE, tblCalendarDtl.EventDate ) < 7
      )
      OR
      (UPPER( tblEventType.EventType ) = 'DEADLINE' AND
       DATE <= tblCalendarDtl.EventDate AND
       DATEDIFF( DATE, tblCalendarDtl.EventDate ) < 30
     ))

Peter Willadt

Thread
Union in dbprocBrian Kavanaugh6 Apr
  • Re: Union in dbproc(Peter Willadt)6 Apr
    • RE: Union in dbprocBrian Kavanaugh6 Apr
RE:Union in dbprocThomas Anhaus7 Apr
  • Unknown Result TableBrian Kavanaugh12 Apr
re: Unknown Result TableBrian Kavanaugh13 Apr
Re: Unknown Result TableMarcin P14 Apr