Outputting results of SQL SELECT statements into a spreadsheet

Tags:
OPENROWSET
SELECT statement
SQL Server
SQL Server Query
I am using OPENROWSET to output the result of a number of SQL SELECT statements into a spreadsheet. It works for most of the SELECT statements, but there are 4 random queries out of 82 that take more than an hour to execute. This is the code: insert into OPENROWSET('Microsoft.Jet.OLEDB.4.0', 'Excel 8.0;Database=D:MGTempESWIConvAuditQueriescnvWriteOff.xls;', 'SELECT Phone, Member, FullName, TransAmount, TransType, WOAmount, WOCode, WODate FROM [PhoneMemberNotInSerord$]') select Phone, Member, FullName, TransAmount, TransType, WOAmount, WOCode, WODate from cnvWriteOff_SWI a where not exists (select * from cnvSerord_SWI b where a.Phone = b.Phone and a.Member = b.Member) Any thoughts?
ASKED: November 7, 2008  8:54 PM
UPDATED: November 7, 2008  9:41 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

What does the performance look like when you run just the SQL part of the SELECT statement?

<pre>select Phone, Member, FullName, TransAmount, TransType, WOAmount, WOCode, WODate from cnvWriteOff_SWI a
where not exists (select * from cnvSerord_SWI b
where a.Phone = b.Phone
and a.Member = b.Member)</pre>

You may have an indexing problem that you need to look for. If this recordset returns quickly then it is going to be an Excel problem.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following