I need to find the user name of the person who modified a particular stored procedure.
How do I find out when a stored procedure was last modified or compiled in Oracle?
gives me idea about the time. But how do I know the user who modified it?
Accessing the log file in SQL Server Profiler Open the desired log file with SQL Server Profiler. You can see the stored procedure name in the ObjectName column and the name of the user who modified the stored procedure name in the LoginName column.
If you need to find out which tables have been recently modified. You can check this by querying the sys. tables in TSQL based on the modify_date column. Here is the TSQL query to select the last modified table based on the recent date in SQL Server.
In SQL Server 2014, you can query sys. dm_sql_referencing_entities and sys. dm_sql_referenced_entities to look for orphaned objects. As @theGameIsWar writes, you can also find the execution data for stored procedures.
The name of the report is Schema Changes History. To run the Schema Changes History report open SQL Server Management Studio, make a right click on an object (the instance name or a database name, for example), then select "Reports", click on "Standard Reports", and then click on "Schema Changes History" report.
Here what it works for me:-
DECLARE @filename VARCHAR(255)
SELECT @FileName = SUBSTRING(path, 0, LEN(path)-CHARINDEX('\', REVERSE(path))+1) + '\Log.trc'
FROM sys.traces
WHERE is_default = 1;
SELECT gt.HostName,
gt.ApplicationName,
gt.NTUserName,
gt.NTDomainName,
gt.LoginName,
gt.SPID,
gt.EventClass,
te.Name AS EventName,
gt.EventSubClass,
gt.TEXTData,
gt.StartTime,
gt.EndTime,
gt.ObjectName,
gt.DatabaseName,
gt.FileName,
gt.IsSystem
FROM [fn_trace_gettable](@filename, DEFAULT) gt
JOIN sys.trace_events te ON gt.EventClass = te.trace_event_id
WHERE EventClass in (164) --AND gt.EventSubClass = 2
ORDER BY StartTime DESC;
Source:- https://serverfault.com/questions/258111/finding-out-who-has-modified-a-stored-procedure-on-sql-server
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With