How do I find all stored procedures that insert, update, or delete records?

后端 未结 3 2100
名媛妹妹
名媛妹妹 2020-12-03 19:14

Is it possible, without parsing source, to select a list of all sproc names that insert, update, or delete records? I need to create a TSQL utility script that will do this.

3条回答
  •  伪装坚强ぢ
    2020-12-03 19:50

    That is the problem with sys.sql_dependencies. SQL cannot accurately track dependencies in stored procedures (there are sound reasons why it can't, but lets no go there now). That is without even considering dynamic SQL or CLR procedures.

    Visual Studio Database Edition has some better capabilities, but it can track dependencies in scipts, not in a live database. It can though reverse engineer live databases into scripts and analyse the resulted scripts, to some better accuracy than sys.sql_dependencies can. It cannot handle dynamic SQL.

提交回复
热议问题