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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 User Login/logout for a month

Author  Topic 

10Dawg
Starting Member

46 Posts

Posted - 2012-07-11 : 14:53:05
The powers that be want to be able to extract a given user login/logout time on about 100 dbs on one instance over a month's time. Is there a stored procedure already written for this. If not, how would I go about writing something like this?

10Dawg

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2012-07-11 : 15:42:08
Not sure what you mean by "user login/logout". Can you send a code example of just one user on one db so we can see what you mean? Part if my confusion is terminology:

sql server entities include:
- server logins (windows or sql)
- database users (each db user is associated with a server login)

events:
users can connect (and disconnect) to/from a server/db. That connection may stay active until they close their session - could be months.





Be One with the Optimizer
TG
Go to Top of Page

10Dawg
Starting Member

46 Posts

Posted - 2012-07-11 : 15:54:42
Ok. The server supports a front end web based application geared towards law firms. A user (law clerk) would log in to their project via the web to review documents. One project = one database. One user may have several projects (dbs). I want a way to track (in sql) who accesses the dbs and when. Does that make sense? Sorry for the scant information.

10Dawg
Go to Top of Page

TG
Master Smack Fu Yak Hacker

6065 Posts

Posted - 2012-07-11 : 16:09:11
Hopefully the front end web application tracks user activity in some table that the developer created. If not there's no way to track the "logins" without keeping a sql profiler trace running which is not recommended. Even if you do keep a trace running it would depend on how the application connects to the server. If it connects via a general application user, which is a typical practice, then even with a trace you can't track by law clerk.

Be One with the Optimizer
TG
Go to Top of Page

10Dawg
Starting Member

46 Posts

Posted - 2012-07-11 : 16:42:37
OK Thanks. I'll pass it along.

10Dawg
Go to Top of Page
   

- Advertisement -