Get the list of stored procedures created and / or modified on a particular date?

后端 未结 5 1545
深忆病人
深忆病人 2020-12-29 01:55

I want to find which stored procedure I\'ve created and also I want to find which stored procedure I\'ve modified in my SQL Server on a particular date like 27 september 201

相关标签:
5条回答
  • 2020-12-29 02:10

    For SQL Server 2012:

    SELECT name, modify_date, create_date, type
    FROM sys.procedures
    WHERE name like '%XXX%' 
    ORDER BY modify_date desc
    
    0 讨论(0)
  • 2020-12-29 02:12

    Here is the "newer school" version.

    SELECT * FROM INFORMATION_SCHEMA.ROUTINES
    WHERE ROUTINE_TYPE = N'PROCEDURE' and ROUTINE_SCHEMA = N'dbo' 
    and CREATED = '20120927'
    
    0 讨论(0)
  • 2020-12-29 02:15
    SELECT name
    FROM sys.objects
    WHERE type = 'P'
    AND (DATEDIFF(D,modify_date, GETDATE()) < 7
         OR DATEDIFF(D,create_date, GETDATE()) < 7)
    
    0 讨论(0)
  • 2020-12-29 02:26

    You can try this query in any given SQL Server database:

    SELECT 
        name,
        create_date,
        modify_date
    FROM sys.procedures
    WHERE create_date = '20120927'  
    

    which lists out the name, the creation and the last modification date - unfortunately, it doesn't record who created and/or modified the stored procedure in question.

    0 讨论(0)
  • 2020-12-29 02:32
    SELECT * FROM sys.objects WHERE type='p' ORDER BY modify_date DESC
    
    SELECT name, create_date, modify_date 
    FROM sys.objects
    WHERE type = 'P'
    
    SELECT name, crdate, refdate 
    FROM sysobjects
    WHERE type = 'P' 
    ORDER BY refdate desc
    
    0 讨论(0)
提交回复
热议问题