4 Replies - 411 Views - Last Post: 11 March 2018 - 01:00 AM Rate Topic: -----

#1 Foobarer   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 269
  • Joined: 28-March 17

Change column into false after specified time

Posted 10 March 2018 - 02:58 PM

I have a table that contains user-created event details.
In this table there are 2 columns specifying the end date and end time of the event as entered by the user.
I was thinking to create an "is_active" column of type Boolean to specify if the event is active or not.
But is it even possible for the database to automatically check if the specified end date and time arrived and change it to false?

Thanks
Is This A Good Question/Topic? 0
  • +

Replies To: Change column into false after specified time

#2 astonecipher   User is offline

  • Senior Systems Engineer
  • member icon

Reputation: 2688
  • View blog
  • Posts: 10,767
  • Joined: 03-December 12

Re: Change column into false after specified time

Posted 10 March 2018 - 03:02 PM

Automatically, no. But a process can and your queries can determine if an event is active
Was This Post Helpful? 1
  • +
  • -

#3 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14578
  • View blog
  • Posts: 58,441
  • Joined: 12-June 08

Re: Change column into false after specified time

Posted 10 March 2018 - 03:02 PM

You can investigate in triggers or even a nightly job to run. I don't know what this is supposed to be tracking but say it's a web page you can always check when the data comes back and update it then on a refresh.
Was This Post Helpful? 1
  • +
  • -

#4 Foobarer   User is offline

  • D.I.C Regular

Reputation: 1
  • View blog
  • Posts: 269
  • Joined: 28-March 17

Re: Change column into false after specified time

Posted 11 March 2018 - 12:38 AM

thanks!
Was This Post Helpful? 0
  • +
  • -

#5 andrewsw   User is online

  • head thrashing
  • member icon

Reputation: 6645
  • View blog
  • Posts: 27,201
  • Joined: 12-December 12

Re: Change column into false after specified time

Posted 11 March 2018 - 01:00 AM

If the event being active is determined from its end date then is it necessary to set a boolean to indicate whether it is active? Whenever you query the table you can just check the end dates, rather than the active flag, for active or inactive events.

(The active flag would be a derived quantity, introducing an extra level of maintenance and possible oversight. see 3NF)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1