Last post Apr 30, 2018 07:12 AM by Deepak Panchal
Apr 29, 2018 02:45 PM|JagjitSingh|LINK
How to schedule View and save data in Excel in Zip format.
Apr 30, 2018 07:12 AM|Deepak Panchal|LINK
You can create a new Job in management studio.
You can use Query below to export data.
INSERT INTO OPENROWSET('Microsoft.ACE.OLEDB.12.0','Excel 12.0;
Database=C:\Users\abc\Desktop\SQL Data.xlsx;','SELECT * FROM [Sheet1$]')
SELECT * FROM dbo.TblScenario
Then you can create a schedule using code below.
Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.
SQL Server Agent, right-click
Jobs, and select
Manage Schedules dialog box, click
Name box, type a name for the new schedule.
If you do not want the schedule to take effect immediately after it has been created, clear the
Enabled check box.
Schedule Type, select one of the following:
To start the job when the CPUs reach an idle condition, click
Start whenever the CPUs become idle.
If you want a schedule to run repeatedly, click
Recurring. To set the recurring schedule, complete the
Daily Frequency, and
Duration groups on the dialog.
If you want the schedule to run only one time, click
One time. To set the
One time schedule, complete the
One-time occurrence group on the dialog box.
Create a Schedule
I did not get any way to export the data in Zip format to Excel.
As a work around, You can first Export to Excel file and use some code to convert that Excel file to Zip.