I have a SQL Server view vwSales
which returns all sales from yesterday. I want to dump the result into an actual table (tblSales
) which needs to be recreated daily.
How to implement it by creating a script and automate the running thru SQL Server Agent?
This is the logic:
If tblSales exist then delete (for data refresh)
Select * from vwSales Insert to tblSales (to be recreated from the result of vwSales)
The job will run once a day before start of business hours.