Find recent object changes in SQL Server Database

前端 未结 3 1583
闹比i
闹比i 2021-02-03 10:31

I\'ve added and modified several (new and existing resp.) tables and stored procs, for a particular d

相关标签:
3条回答
  • 2021-02-03 10:44

    Hi you can get the changed/modified db object details with this query

    select name,create_date,modify_date
    from sys.procedures
    order by modify_date desc
    

    Thanks

    0 讨论(0)
  • 2021-02-03 10:46

    I don't think you're going to be able to find what you're looking for. SQL Server just doesn't track that information out of the box.

    To handle this in the future, you can use some kind of source control (redgate, for one: http://www.red-gate.com/products/sql-development/sql-source-control),

    or you can set up a DDL trigger (one such technique is described here: https://dba.stackexchange.com/questions/33541/how-to-keep-history-of-sql-server-stored-procedure-revisions/33544#33544).

    0 讨论(0)
  • 2021-02-03 10:56

    Query the sys.objects table to find the objects that changed and filter by modify_date and type; U = User table, P = Stored procedure.

    select * 
    from sys.objects 
    where (type = 'U' or type = 'P') 
      and modify_date > dateadd(m, -3, getdate()) 
    

    This approach will tell you what objects have changed, but not the specific changes.

    0 讨论(0)
提交回复
热议问题