The question:
I created a user and I would like to know the history of the stored_procedures he manually ran and the SQL queries he executed, how do you do that? Is this possible in MSSQL?
The Solutions:
Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.
Method 1
What you’re looking for is a feature called SQL Server Audit which allows you to specify a number of events that get logged, including who runs which stores procedures and queries. I believe specifically you’ll want to enable the database audit in the specific databases you want to log, when you care about those kinds of events.
The catch is you have to enable and configure it first, as it’s not on by default. Also please note auditing features of SQL Server do add some overhead to resource consumption, especially with the more events you setup to be audited.
Please also see A quick overview of database audit in SQL for further information and overview on how it works.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0