> 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? -- Derek _______________________________________________ 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.

