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
 How to check values
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

yaman
Posting Yak Master

India
213 Posts

Posted - 09/26/2012 :  06:38:15  Show Profile  Reply with Quote
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

5155 Posts

Posted - 09/26/2012 :  06:45:34  Show Profile  Reply with Quote
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
Go to Top of Page

yaman
Posting Yak Master

India
213 Posts

Posted - 09/26/2012 :  06:56:01  Show Profile  Reply with Quote
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
Go to Top of Page

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 09/26/2012 :  07:23:17  Show Profile  Reply with Quote
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
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.14 seconds. Powered By: Snitz Forums 2000