Forum Discussion
Thank you Valla, I was actually trying ot find a way to copy all the rows faster. This solution also goes row by row, so it would be significantly slow while copying around 400k rows to an excel.
Appreciate you taking time looking at this.
Thank you
Abhi
Let's approach from perhaps a different direction. What's the purpose for the output to XLS? What are you intending to do with it?
- Adagio6 years agoFrequent Contributor
So I'm trying to run a SQL query on production data which would flag some transactions, export them in a spreadhsheet and save it in a location. A notification goes out to someone to review these faulty transactions.
I can still do all of this but not so quick. When the program reads the query results row by row and copies to the excel, it takes 2 minutes/1000 rows. I'm trying to make it <10 sec.
Thank you
Abhi
- tristaanogre6 years agoEsteemed Contributor
Yeah, in script code, I don't think you're going to get to that <10 sec requirement. You'll need to execute some sort of SQL server side command to dump the table off into an Excel file. Some sort of SSIS job or mssql command line I think is what you're going to end up needing to do.
- AlexKaras6 years agoChampion Level 3
Hi,
A variation of what was suggested by anupamchampati:
https://www.sqlservercentral.com/Forums/912903/exporting-ADO-recordset-straight-into-CSV-or-Excel (.CopyFromRecordset() method).
Related Content
- 9 years agohxiao
- 6 years agonimishbhuta
- 4 months agoAdam2696
Recent Discussions
- 3 days agoMW_Didata