Walter Meester
HoogkarspelPays-Bas
Information générale
Forum:
Microsoft SQL Server
Versions des environnements
SQL Server:
SQL Server 2012
>>The optimizer is not always able to optimize a query in the optimal way if you set the parameters in the script. Usually this does go ok when using parameterized Queries.
>>
>>Perhaps eliminating the OR with IN() resolves the problem
>
>Thanks for the suggestion but this was tested an hour ago with same result.
ok, let me ask the question. Why are you setting the values in the script? Can't you set the values through parameters (instead of using variables)? SQL server is able to do parameter sniffing and use that to optimize the plan.
If you have to do it through a script it might be an idea to use the sp_executesql stored procedure which in itself will start another optimization round.
Walter,
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement