SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 db self check
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

elic05
Yak Posting Veteran

62 Posts

Posted - 11/23/2010 :  12:53:00  Show Profile  Reply with Quote
is their a way
that i can tell the db to check a specific field in a table
at set intervals

i want it to run a check every 2 minutes
to check for users that their rows were not updated for two minutes
i what these users to be removed from the table

tkizer
Almighty SQL Goddess

USA
37119 Posts

Posted - 11/23/2010 :  12:54:43  Show Profile  Visit tkizer's Homepage  Reply with Quote
Yes you can do this via a SQL Server Agent job.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 11/23/2010 :  12:56:59  Show Profile  Reply with Quote
quote:
Originally posted by elic05

is their a way
that i can tell the db to check a specific field in a table
at set intervals

i want it to run a check every 2 minutes
to check for users that their rows were not updated for two minutes
i what these users to be removed from the table




What?

Your goal is an empty database?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

TimSman
Posting Yak Master

USA
127 Posts

Posted - 11/23/2010 :  12:59:40  Show Profile  Reply with Quote
2 minutes? Better make the bathroom breaks real quick.
Go to Top of Page

elic05
Yak Posting Veteran

62 Posts

Posted - 11/23/2010 :  14:19:31  Show Profile  Reply with Quote
I will explain.

i build a chat room
its built by flash/actionscript that connects the server throuth aspx/vb.net

everyone that connects to the room with a username is listed in the users table
since the server cant talk to the client
i have a function on the client (flash object) that sends a request to the server to get data
the data:
a. new messages
b. new users
c. users that left the room
on every user request i update in the users table the time of the last request
the request is made every 2 seconds


if a user use the logout button
i can inform the server (using actionscript) to remove him from the users table
but if he just closes the browser
the server cant know that this user is no longer connected
unless the server checks from time to time to see if some user dont request data anymore

therefore i have a field in the users table that is updated on every request by the time of the last request

and i want the server to check from time to time (lets say every 2 minutes) what was the last time of request of every user
if their was no request for the last minutes
the user is not connected he closed the browser.


Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 11/23/2010 :  15:22:41  Show Profile  Reply with Quote
Do you store the connection time?

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

elic05
Yak Posting Veteran

62 Posts

Posted - 11/23/2010 :  17:29:23  Show Profile  Reply with Quote
i store the last request time of the user

Edited by - elic05 on 11/23/2010 17:35:19
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 11/23/2010 :  17:31:32  Show Profile  Reply with Quote
well post the DDL of the table(s) you are using

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx


Want to help yourself?

http://msdn.microsoft.com/en-us/library/ms130214.aspx

http://weblogs.sqlteam.com/brettk/

http://brettkaiser.blogspot.com/


Go to Top of Page

elic05
Yak Posting Veteran

62 Posts

Posted - 11/23/2010 :  17:42:02  Show Profile  Reply with Quote
I cant see my database in the SSMS (i dont know why)

i have there 3 fields

table Name: users
userName, nvarchar(20)
lastRequestTime, time(7)
lastMsgId, int
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000