Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

Get your favorite SSC scripts directly in SSMS with the free SQL Scripts addin. Search for scripts directly from SSMS, and instantly access any saved scripts in your SSC briefcase from the favorites tab.
Download now (direct download link)

Find dependencies between field and sp/function

By Raymond Xie,

I would like to share my experience on how to find out dependencies between a table's field name and stored procedures or functions.

I often encounter situations that require database schema changes to meet business requirement changes. For example, changing the name for some fields. It might be an easy thing if the database is small and not used for a complex front-end. However, in my cases, changing a field's name often means:

  1. table schema change
  2. stored procedures change
  3. functions change
  4. data access layer code change
  5. data presentation layer code change

At least the first three are in the SQL scope, and it would be time consuming if we have to open each stored procedure or function and search from there.

This script is not complicated but rather a handy tool. It will list all the stored procedures and functions that contains the given keyword passed as a parameter, and will further indicate if the keyword is actually used as a parameter. This is important because it helps me to find out what functions are related to it in my data access layer code.

There are some limitations:

  1. All my stored procedures start with sp or dd, so you should modify the script to meet your own situation.
  2. All my stored procedures are no longer than 3000 characters, so if you have a longer one, please increase the parameter in the script.
  3. Keyword length is set to varchar(20). You can increase it by modifying the script if you want to search for a longer keyword.

Total article views: 824 | Views in the last 30 days: 17
 
Related Articles
FORUM

Which Stored Procedure changed

Which Stored Procedure changed

FORUM

Call Stored Procedure from a Function

Call Stored Procedure from a Function

FORUM

Calling Scalar Function within stored Procedure

Calling Scalar Function within stored Procedure

FORUM

Stored procedure in User defined function?

Can I call Stored procedure in User defined function?

FORUM

Implementing a function within a stored procedure

Implementing a function within a stored procedure

Tags
dependencies    
parameter    
 
Contribute

Join the most active online SQL Server Community

SQL knowledge, delivered daily, free:

Email address:  

You make SSC a better place

As a member of SQLServerCentral, you get free access to loads of fresh content: thousands of articles and SQL scripts, a library of free eBooks, a weekly database news roundup, a great Q & A platform… And it’s our huge, buzzing community of SQL Server Professionals that makes it such a success.

Join us!

Steve Jones
Editor, SQLServerCentral.com

Already a member? Jump in:

Email address:   Password:   Remember me: Forgotten your password?
Steve Jones