Search code examples
sqlexcelsql-server-2008export-to-excelsql-agent-job

How to Export data to Excel in SQL Server using SQL Jobs


I need to export the data from a particular table in my database to Excel files (.xls/.xlsx) that will be located into a shared folder into my network. Now the situation is like this -

  1. I need to use SQL SERVER Agent Jobs. 2.I need to generate a new excel file in every 2 minutes that will contain the refreshed data.

    I am using sql server 2008 that doesn't include BI development studio. I'm clueless how to solve this situation. First, I'm not sure how to export the data using jobs because every possible ways I tried had some issues with the OLEDB connection. The 'sp_makewebtask' is also not available in SQL 2008. And I'm also confused how to dynamically generate the names of the files.

    Any reference or solution will be helpful.


Solution

  • I found a better way out. I have created a SSIS(SQL Server Integration Services) package to automate the whole Export to Excel task. Then I deployed that package using SQL Server Agent Jobs. This is a more neat and clean solution as I found.