Search code examples
sqlsql-servertriggersjobs

How can make auto change in SQL Server


I want to make auto changes in SQL Server. I have a table which has a column [expires date]. Should I use a trigger or job for this? I want that SQL Server checks those dates every day, and if any of it is < DateTime.Now, it must change a column [IsPremium] of that row.


Solution

  • Add the following statement in your Daily running JOB, if you have. (Your question in unclear. As per my understanding I post this)

    UPDATE <tablename> SET
           IsPremium = 1
    WHERE  [expires date] < GETDATE()