Monday, April 11, 2022

Stored procedure created & last modified date

To go alongside the last executed date of the stored procedure, you can use this to tell you when the procedure(s) were created and last moddified.  

       SELECT

             [DatabaseName] = DB_NAME(),
             [ProcedureName] = SCHEMA_NAME([schema_id]) +'.'+ [name],
             [Created] = create_date,
             [LastModified] = modify_date
       FROM
             sys.objects
       WHERE
             [type] = 'P'


Should return a little something like this:













You can narrow it down to a single procedure by adding this into your WHERE clause:


    AND [name] = 'usp_BackupAudit'





Stored Procedure - Last Executed Date

No comments:

Post a Comment