sql - update with subselect/how to select time greater than 24 hours -
Please see the image below. I'm new to SQL syntax and I have the following update statement with a sub-style. I'm not sure this is the right way to do this, but I have it.
Check out what I have to do LastRestartTime
and if this is more than 24 hours RestartInterval
, update the restart time for the current time.
I have an exe that will check the table for the is active = 1 and RestartInterval & gt; = 24
, it will kill and restart (or just stop the process if it was stopped) Process
Then I will use LastRestarttime
in that current time Want a program to update
I'm not sure how to do this.
Update any _table.dbo.this database LastRestartTime = GetDate () in ProcessName (choose the name of the process from any_table.dbo. This database where LastRestartTime> 24);
It does not appear that you need a subquery, try:
any _table Dbo.thisDatabase SET LastStarttime = CURRENT_TIMESTAMP Where Last Lastime & lt; = DATEADD (hour, -24, CURRENT_TIMESTAMP);
Comments
Post a Comment