Connecting Tech Pros Worldwide Forums | Help | Site Map

saving userlogon time

Member
 
Join Date: Jan 2009
Posts: 57
#1: Feb 19 '09
Hi All,

We have an windows application running on different systems , We want to mentain a log of user login time(UserName:LoginTime) can someone please tell me how can i do that. (i have to display that log in a internal web based system and i am not supposed to touch windows application but i can write stored pocedures in sql server).

Regards,

Vineet Bindal

ck9663's Avatar
Expert
 
Join Date: Jun 2007
Posts: 1,925
#2: Feb 19 '09

re: saving userlogon time


It really depends on how your user login to your application.Does it write anything on any table once it login? You have to see how the windows login and interact/interface with your database.

-- CK
Member
 
Join Date: Jan 2009
Posts: 57
#3: Feb 19 '09

re: saving userlogon time


it depends on the user. sometimes they write and sometimes they dont.. what i was thinking is whenever user logs in they have to be varified with username and password ...is there any way to track that from usertable? when and which user is being varified from that table?
ck9663's Avatar
Expert
 
Join Date: Jun 2007
Posts: 1,925
#4: Feb 19 '09

re: saving userlogon time


You might need to just use the logging mechanism of the SQL Server. However, if the user is using a single logon/local account, you will not be able to identify them individually.

-- CK
Member
 
Join Date: Jan 2009
Posts: 57
#5: Feb 19 '09

re: saving userlogon time


I GOT IT

SELECT
TimeStart as 'Login Date',
CONVERT(VARCHAR(5), TimeStart, 108) as 'Login Time',
U.UserName as 'User',
L.UserLevelDesc as 'Role',
left(P.Param2, 8) as 'BP Version'
FROM
SY_ProcessLog P
left join Users U on p.userid = U.UserID
left join SY_UserLevel L on U.UserLevelID = L.UserLevelID

WHERE
TimeStart >= @FromDate2
and P.Process in ('Start')
and U.UserName <> 'BP ADMIN'
ORDER BY
P.TimeStart desc
Reply