Re: Using CAST() in WHERE Clause hangs/slows Query

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: ckaneko (ckaneko_at_ffi-hq.com)
Date: 05/25/04


Date: Tue, 25 May 2004 13:28:46 -0700

Thanks everyone. I did remove the casting and it did make a big difference!
I created the query in a view then placed it into a stored procedure. The
view placed the Cast function in there.

I still don't understand as to why the query runs quickly sometimes and
other times it doesn't.

"Guillaume" <mssupport@candg2.com> wrote in message
news:310186B3-1158-4766-BB4F-07D239A65D77@microsoft.com...
> I don't pretend to be giving a definitive answer on this, but from what I
know, when you use a function (like CAST) on a column it disables the use of
any regular index on that column.
>
> If you have a lot of data, the simple overhead of using a function could
also slow it down.
>
>



Relevant Pages

  • Re: noise words, @@ERROR, and stop and resume indexing
    ... > Noiseword varcharNot Null ... > the data from the noise file to the noise_words table. ... >> A clause of the query contained only ignored words. ... >> into query analyzer before starting the stored procedure. ...
    (microsoft.public.sqlserver.fulltext)
  • RE: ODBC query in VB code Need HELP
    ... I am trying to get a stored procedure to run on info I send it I do not need ... I played around and got the code below to work using a pass-through query, ... Dim strpass As String ...
    (microsoft.public.access.formscoding)
  • Re: slowing/halting stored procedure from ado.net
    ... calling the same stored procedure from SQL> Management ... > Studio goes without any slowdown, ... > There was/is no big job running on the sql server, ... >> Erratic performance of any query is usually due to something changing. ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Database Engine Tuning Advisor suggestion to replace syntax.
    ... Actually, what I said was "IF this code is running in a stored procedure", ... execution with the execution plan generated for the first execution. ... SQL Server does not have to compile the second statement." ... replace query 1 below with the syntax in query 2 below. ...
    (microsoft.public.sqlserver.tools)
  • Re: Query parameters - Tricky Stored Procedure Question
    ... Dim tConnection As SqlConnection = New SqlConnection ... Here you would pass in your constructed ad-hoc query ... This is one case in which an inline ad-hoc query would be preferable ... how is it possible to create a stored procedure which can ...
    (microsoft.public.dotnet.languages.vb)