Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Speed in Store procedure and Query Analyser
Message
De
29/05/2001 08:10:19
 
 
À
28/05/2001 19:52:36
Larry Santos
Local Data System
Philippines
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00511319
Message ID:
00512142
Vues:
13
I don't have a firm answer. I'd wouldn't be surprised if the stored procedure
was doing a table scan due to the work that occurs in the WHERE clause
>    (CAST (CAST (t.nMONTH AS VARCHAR)
>    + '/01/' + CAST (t.nYear AS VARCHAR)
>    AS DATETIME)
>    >= CAST (CAST(@M3 AS VARCHAR)+'/01/'+CAST(@Y3 AS VARCHAR) AS DATETIME) AND
>    CAST (CAST (t.nMONTH AS VARCHAR)
>    + '/01/' + CAST (t.nYear AS VARCHAR)
>    AS DATETIME)
>    < CAST (CAST(@M4 AS VARCHAR)+'/01/'+CAST(@Y1 AS VARCHAR) AS DATETIME))  and
>	t.CDISTmgr = @cDistMgr
I wonder if the query optimizer is doing somekind of substitution on these values when the query is submitted as ad-hoc.

Does the stored procedure speed up if you create the DATETIME values outside of the query? At least two of them appear to be constant once the variables are assigned.

-Mike
Michael Levy
MCSD, MCDBA
ma_levy@hotmail.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform