Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL Query
Message
 
À
31/03/1999 16:30:14
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Titre:
Divers
Thread ID:
00203888
Message ID:
00204230
Vues:
19
>I think I read in the VFP hackers guide that the between function works faster than >= and <= operators.
>
This query is being executed on SQL Server if that makes any difference. I am going to change the code to use the between command.


>>>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.
DLC
"Use the Right Tool for the Job!"
davidandcynthia@email.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform