Derek Kalweit <> wrote:
>> OK. I can't understand why, but using dateadd() or using the T-SQL
>> with variables as Ricardo recommended causes the statement to execute
>> sub-second compared to the 17-30 second response otherwise. MSSQL
>> Query Analyzer shows a different execution plan using getdate()-7
>> versus dateadd(day, -7, getdate()):
> 
> All that, and I go to implement the 'fix' and realize that the
> getdate() and getdate()-7 was only for my debugging the statement and
> is not the real problem... Using literal dates in the string(which is
> what the actual code does) is just as slow as using getdate() and
> getdate()-7. I tried wrapping them with dateadd(day,0,...) functions,
> and it's still slow....... ideas?    

What is the execution plan for your code?  Ctrl + L is the keystroke for
generating it I think.  

Stephen Russell
DBA / .Net Developer

Memphis TN 38115
901.246-0159

"A good way to judge people is by observing how they treat those who
    can do them absolutely no good." ---Unknown

http://spaces.msn.com/members/srussell/

No virus found in this outgoing message.
Checked by AVG Free Edition. 
Version: 7.5.467 / Virus Database: 269.7.0/803 - Release Date: 5/13/2007
12:17 PM
 



_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[EMAIL PROTECTED]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to