This stored procedure can be used to insert the result set of the particular select statement into Excel file (c:\ImportToExcel.xls, by default). You can pass the server name, user name, user password, the select statement to execute, and the file name to store the results set, as in the example below:
/* Version: SQL Server 7.0/2000 Created by: Alexander Chigrik - all about MS SQL (SQL Server Articles, FAQ, Scripts, Tips and Test Exams).
This stored procedure can be used to insert the result set of the particular select statement into Excel file (c:\ImportToExcel.xls, by default). You can pass the server name, user name, user password, the select statement to execute, and the file name to store the results set, as in the example below: