Reputation: 377
i am new in SQL, i am trying to update a table once a day by creating a batch, can anybody please guide me through this. I will really appreciate any help.
This is what i'm trying to accomplish:
update Products
Set DaysLeft =(
SELECT DATEDIFF(day, getDate(), ExpirationDate) from Products
)
Upvotes: 1
Views: 3425
Reputation: 1384
You can use the Azure Automation service to schedule workflows that run on a daily basis in Azure. These workflows can contain any Powershell commands, including commands invoking SQL statements. A good example of using Azure Automation with Azure SQL is covered in this blog: http://azure.microsoft.com/blog/2014/06/26/azure-automation-your-sql-agent-in-the-cloud/
Upvotes: 0
Reputation: 377
This is what I tried and it works.
ALTER TABLE Offer
ADD daysLeft as (DATEDIFF(day, GETDATE(),ExpirationDate ))
Upvotes: 1
Reputation: 19
You can create a procedure to update a table and then u can create a job calling that procedure , you can keep the frequency of the job everyday at whatever time you want to set .
for job creation you can use DBMS_JOB
Thanks, Abhimpi
Upvotes: 1