How to identify in the SQL Server 2005 function is being used in the stored procedure or other objects?
I need to modify function and I need to know what the impact might be by looking other object that depending on this function such as stored procedure, function etc etc. Now, is there anyway I can find thi开发者_JAVA百科s that can go through all codes? I have a lot of stored procedure/functions on this.
There is possibility within storedproc that have a dynamic constructed query such as @SQL = 'SELECT BLA BLA'
Is there any third party tools that can be used to detect this?
Thank you
Third Party Tools
Redgate SQL Refactor or Dependency Tracker might be best actually.
Apex SQL Clean
Home Made Solutions
You can use sp_depends
but this depends on the dependency information being up to date.
Running sp_refreshsqlmodule
on all objects in the database can update this if there is any missing dependency information.
This won't find places where you have used it in dynamic SQL though. You may be able to track these down with.
select object_name(object_id)
from sys.sql_modules
where definition like '%Your Function Name%'
Assuming that your dynamic SQL string doesn't bizarrely split the function name up.
精彩评论