| Author |
Topic  |
|
|
yaman
Posting Yak Master
India
213 Posts |
Posted - 09/26/2012 : 06:38:15
|
Sir,
I need to check value at 2 mins ..
Problem is that I need to check status of user If status of user is same for two miniute then I need to update .
how can I check that values for 2 min in sql server .
Please suggest me.
Thanks & Regards Yaman
Yaman |
|
|
sunitabeck
Flowing Fount of Yak Knowledge
5152 Posts |
Posted - 09/26/2012 : 06:45:34
|
Did you mean to say that you have data in a table that has a time column and a status column OR, are you trying to add to/update the data in a table live at 2-minute intervals?
If you can post some sample data and expected output along with the table schema, people on the forum would be able to suggest solutions.
This page may help in formulating the question:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
yaman
Posting Yak Master
India
213 Posts |
Posted - 09/26/2012 : 06:56:01
|
Create table ustatus(name varchar(100),ustatus bit)
INSERT INTO ustatus(name, ustatus) SELECT 'A',1 UNION ALL SELECT 'B',0 UNION ALL SELECT 'C',0 UNION ALL
--Whenever ustatus of user 'A' is 1 for exaclty 2 mins(not less than 2) then I need to change ustatus = 0 .
--IF ustatus of user 'A' is change before 2 min then no change in ustatus.
--then how can I check ustatus of all users continously for 2 min . Please suggest Sir
Yaman |
 |
|
|
sunitabeck
Flowing Fount of Yak Knowledge
5152 Posts |
Posted - 09/26/2012 : 07:23:17
|
If I understood your requirement correctly, I don't know of a way to do this in SQL Server.
In SQL Server, - you can check the table every two minutes and - if you had another column in your table that indicated the time stamp of the last update
then you can update rows for which time stamp is earlier than the current time by at least two minutes to status 0.
However, that would be a periodic check - not an event-based check - which means the time at which the status is changed to zero may be anywhere from two to four minutes. |
Edited by - sunitabeck on 09/26/2012 07:23:57 |
 |
|
| |
Topic  |
|