June 19, 2002 at 1:25 pm
Hello!
I'll explain my proble as good as I can. I'm trying to make a system for my web site so that I can see who is online and active, online but idle and who is offline.
I have a table with two colums like this:
MembersOnline
memID | status
123 | 0
43 | 0
3543 | 1
199 | 0
0 = active
1 = idle
if the memID isn't there = user is offline
Now, I could have made a table with a datetime where I could have stored the user's last event time. But I thought that it would take too much system resources...
This is how far I've come:
1. I insert a row when the user logs in -> status = active
2. If the user doesn't do anything within 10 minutes his/her session expires -> status = idle
Changing the status to idle is really easy with asp sessions expiration events. But after the session has expired I really can't do anything with asp. So, this is what I want to do: I want the SQL server to wait one hour and then delete the record. But I also want to be able to cancel the deletion if the user "wakes up"
Any suggestions?
June 19, 2002 at 5:01 pm
Then you will need to add a third column for last change. Then either submit a GETDATE() value into it or create a trigger to update the value when a change occurrs. This will be the only way your process will know the time.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
June 20, 2002 at 8:49 am
Hello!
Would a timestamp do? Can it be used as a datetime? Or am I totally wrong?
/tomI
June 20, 2002 at 9:33 am
Timestamp is not a date time value. From BOL.
quote:
Is used to indicate the sequence of SQL Server activity on a row, represented as an increasing number in a binary format. As a row is modified in a table, the timestamp is updated with the current database timestamp value obtained from the @@DBTS function. timestamp data is not related to the date and time of an insert or change to data. To automatically record times that data modifications take place in a table, use either a datetime or smalldatetime data type to record the events and triggers.
"Don't roll your eyes at me. I will tape them in place." (Teacher on Boston Public)
June 20, 2002 at 9:43 am
Ok, thanks!
I think I what I'll do. Thanks
/tOmi
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply