Answers for "Sql to search who modified"

SQL
0

Sql to search who modified

SELECT DISTINCT
              StartTime
          ,hostname
       ,LoginName
          ,ObjectName
         
          ,CASE
                     WHEN EventClass = 46 THEN 'Created'
                     WHEN EventClass = 47 THEN 'Dropped'
                     WHEN EventClass = 164 THEN 'Altered'
              END as EventClass
       --,f.*
FROM   sys.traces t
       CROSS APPLY fn_trace_gettable(REVERSE(SUBSTRING(REVERSE(t.path),
                                                       CHARINDEX('\', REVERSE(t.path)),
                                                       260)
                                             ) + N'log.trc', DEFAULT) f
WHERE  t.is_default = 1
       AND ObjectName like 'stored_proc_name'
       AND EventClass IN (46, /*Object:Created*/
                          47, /*Object:Dropped*/
                          164 /*Object:Altered*/ )
ORDER BY StartTime DESC
Posted by: Guest on April-06-2021

Code answers related to "SQL"

Browse Popular Code Answers by Language