We have several Microsoft SQL servers in our organization and the previous DBA have not performed user reviews on any of them, so some servers are filled with inactive local users. I have a script that looks at their last logon date:
SELECT MAX(login_time) AS [Last Login Time], login_name [Login]
FROM sys.dm_exec_sessions
GROUP BY login_name
ORDER BY [Login] ASC;
But how can I create a similar script that lists all jobs and reports made by the user, so that they won't stop working when and if I delete the inactive users? Are there any best practices when it comes to deleting users from Microsoft SQL Servers?