Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2007-07-31 : 11:30:18
|
| I want a select query, which will be used to authenticate/allow a user to logon to the application, for any user if they are trying to login to the application. i will check - are they currently logged onto the system, by checking the bit value of (islogged) , if the bit value is 0 then, they are good. if the bit value of islogged is 1, then would like to check the loggedtime getting the diff(minutes) between system time and loggedtime(column is table for that userid), if it is greater than 3 minutes then i would like to allow the user to log into the system. will be taken care at the fronend.please help me. here is my table design and the select query at the bottom.Table name: TblUserSession:USessionID int UncheckedUserId int CheckedIsLogged bit CheckedLoggedTime datetime CheckedU_sessionid nvarchar(100) Checkedselect islogged, loggedtime from TblUserSession where userid=3 and loggedtime = (systemtime - loggedtime) or islogged = 0 Thank you very much for the information. |
|
|
rudesyle
Posting Yak Master
110 Posts |
Posted - 2007-07-31 : 11:54:43
|
| Not sure about your architecture, but I would just return the islogged and loggedtime back to the client app and handle this there. |
 |
|
|
cplusplus
Aged Yak Warrior
567 Posts |
Posted - 2007-07-31 : 12:12:49
|
Hello Rudesyle, I am sorry. i know i confused the whole thing by putting everything into one:Can you atleast tell me how to get the difference of time in Minutes.forget about the islogged: bit type 1 or 0.Thank you very much...quote: Originally posted by rudesyle Not sure about your architecture, but I would just return the islogged and loggedtime back to the client app and handle this there.
|
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-07-31 : 12:19:45
|
| datediff(n, date1, date2)_______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
|
|
|
|
|