Sql-server – Who is using a SQL Server database user credential

sql serverusers

I have a database user — let's say "x" — and I want to know how many Windows (desktop) users are using this database user (who2 or who is only give the current result, I want to know the entire history)?

Actually this question arise when you join any new organization and you don't know how many Windows or desktop users are using a specific database user. Is there any way to know this? How do you track all Windows users who are using this (x) user credential?

Best Answer

You could use a logon trigger perhaps, going forward (see here and here).

For historical information, by default, SQL Server doesn't even track successful logins (though this can be turned on - however it means you will need to parse the SQL Server log for some little bit of information). So while you might get some information (such as which workstations were using which logins) from the default trace, it would rely on them performing actions that get logged there (and would only go back as far as your default trace data goes anyway).

Also see this answer.