locked
How to reset a column value to 0 after every 24 hours RRS feed

  • Question

  • User-1257308419 posted

    i have a table with column count in sql server which i need to reset to 0 after every 24 hours using asp.net mvc.

    issue is that i can't use trigger because as far as i know godaddy don't allow it and my asp.net mvc project is shared hosted using godaddy.

    so what might be the other reliable ways through which i can make sure after every 24 hours/daily my table column count is reset to zero?

    Thursday, August 27, 2020 7:44 PM

All replies

  • User475983607 posted

    i have a table with column count in sql server which i need to reset to 0 after every 24 hours using asp.net mvc.

    issue is that i can't use trigger because as far as i know godaddy don't allow it and my asp.net mvc project is shared hosted using godaddy.

    so what might be the other reliable ways through which i can make sure after every 24 hours/daily my table column count is reset to zero?

    Most hosting services provide scheduled tasks as a feature.  I recommend reaching out to GoDaddy support. 

    There are ASP.NET scheduling APIs but your site needs to be running.  Typically, websites spin down after when they are not being used.  If the site is not running then the scheduler is not running; https://www.hangfire.io/

    Thursday, August 27, 2020 8:08 PM
  • User1686398519 posted

    Hi Learner94,

    You can create a SQL agent job that executes a stored procedure to reset a column value to 0.Below are the links on how to create a job, you can refer to it.

    1. Configure SQL Server Agent
    2. Create a Job
    3. Creating a Job with Steps and a Schedule in Visual C#
    4. sp_add_jobschedule

    Best Regards,

    YihuiSun

    Wednesday, September 2, 2020 8:36 AM