views:

38

answers:

2

I have many databases in one SQL Server instance. Also I have many individual domain users for logins and also domain groups as logins. These logins are attached to databases as database users. Now I would like to create a report (or a query) to find out when and where (which database) these logins take a connection. I tried to find this information from sys-schema, but I could not find this kind of information. Where SQL Server store this information and how to create this kind of report? I would also like to automate this using a stored procedure.

+1  A: 

in the login stored procedure, along with the username, add a GetDate() and DB_NAME() to each record in a table called LoginData (or whatever you prefer)

warsong
if you need me to elaborate on this, let me know. i am at work, and tend to rush answering a bit.
warsong
A: 

You could set up a SQL trace logging all login events then just query that.

Martin Smith