Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Query
Message
 
To
31/03/1999 15:39:38
Bob Lucas
The WordWare Agency
Alberta, Canada
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Miscellaneous
Thread ID:
00203888
Message ID:
00204233
Views:
18
>>I have a SQL Server 6.5 query that is based on a date range. For example, if I put in 03/01/1999 and 03/15/1999 I get results quickly. If I put in 03/01/1999 and 03/31/1999 it takes a very long time. Any ideas?
>>
>>The code:
>>
>>SELECT id, first, middle, last, type, expdt, fromdt, thrudt, 9999.99 as dues, 999 as instal, 9999 as months from master where group = 'Member' and delet <> 1 and exprdt >= m.expdt1 and expdt <= expdt2 and id not in (select dueid from dues where period = ?m.period or (duetype = 'LIFE' and thrudt = '12/31/9999')) order by last
>
>SQL Server may be employing a table lock because of the larger date range and because of the number of pages required to fulfil the query.
>
>You could try a couple of things. Use a clustered index for expdt. It could be a problem with statistics that are used by the query optimizer. Try updating statistics. You might even try rearranging your where clause. try putting the conditions that have the fewest records at the beginning.

Thanks for the reply. It could be the locks or one of your other suggestions.
I will let you know.
DLC
DLC
"Use the Right Tool for the Job!"
davidandcynthia@email.com
Previous
Reply
Map
View

Click here to load this message in the networking platform