Search code examples
sql-serversql-server-2008ms-wordmailmerge

Office SQL Query long runtime


I've got a database View in SQL Server 2008 and when I run it from Query Analyser, it runs within a couple of seconds. When I run it in Excel 2007, it loads the data just fine. But when I run it in Word 2007 on a mail merge, it just seems to take a very long time to run (literally minutes to run).

If anyone has an idea how to solve this, could they let me know?


Solution

  • SQL 2008 will allow you to run a Profiler trace on the query. Start the trace before you kick off the Word query and see how long it takes. My guess is it's the mail-merge that's slow.

    If it were slow in Excel too, you'd be looking at your indexes.