IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    SQL BETWEEN equalivent
Go
New
Search
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Member
Posted
I've run into a snag with an index on DB2 within a large transaction table. The DBA has utilized the FIELDNAME (a date field) as an index.
If I simply use a
WHERE FIELDNAME GT '2004-01-19' AND
FIELDNAME LT '2004-12-31'

DB2 appears to ignore the index and scan the table. If within direct SQL I utilize a BETWEEN command on those dates DB2 will utilize the index (and speed things up).

Any suggestions of a FOCUS equalivent of a between short of direct SQL? (DB2/MVS) Focus 7.2
 
Posts: 6 | Location: Grand Rapids, MI | Registered: April 25, 2003Reply With QuoteEdit or Delete MessageReport This Post
<Grzegorz>
Posted
The syntax equivalent of SQL BETWEEN is (informally):
TABLE FILE ...<br />...<br />WHERE <field> FROM <value1> TO <value2><br />...<br />END
but I did not checked yet, how is it translated to SQL for the relational adapter.

Regards
Grzegorz
 
Reply With QuoteEdit or Delete MessageReport This Post
Member
Posted Hide Post
Many thanks!
That appears to be taking advantage of the index.
 
Posts: 6 | Location: Grand Rapids, MI | Registered: April 25, 2003Reply With QuoteEdit or Delete MessageReport This Post
<pranas>
Posted
How about using SQL Passthru?

SET SQLENG=<engine>
SQL
<native_sql>
END

It helps writing eficient code (specialy when timestamp fields used :-)

Pranas
 
Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

IB - Developer Center    Forums  Hop To Forum Categories  FOCUS/WebFOCUS    SQL BETWEEN equalivent

Copyright © 1996-2008 Information Builders, leaders in enterprise business intelligence.