title: How to schedule to run SQL script on SQL Server?
body: <p>I want to use MS SQL Transact-SQL to schedule to run a script <code>C:\script\my_script.sql</code> at 6 pm every day, except Saturday and Sunday.</p>
  
  <p>Then, the result is saved in the folder <code>C:\data\xxx.csv</code> where <code>xxx</code> is the date of running the script, e.g. <code>2019-2-18</code>.</p>
  
  <p>Here I want to schedule a script (or auto backup a table) which get complete data from a sql table and store it in another table with that day date as database name, which can be use to see records of data on any day. </p>
  
  <p>Furthermore, how to delete the schedule task?</p>
  
  <p>I used server agent but I cannot view the text.</p>
  
  <p><a href="https://i.stack.imgur.com/JYrIC.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JYrIC.png" alt="enter image description here"></a></p>
  
  <p>Thank you very much.</p>