r/SQL • • Jun 02 '26

SQL Server Table Dependency

Hi Team

Can you tell let's say we are adding new column in a table and we have to find which stored procedure is using that table how can we find in below :

  1. Sql Server

  2. Sybase

1 Upvotes

13 comments sorted by

3

u/Eleventhousand Jun 02 '26

For SQL Server, you should be able to use something like:

select * from sys.sql_modules where definition like '%somethign%'

0

u/Dangerous_Word7318 Jun 02 '26

What is something here table name need to mention 

2

u/alinroc SQL Server DBA Jun 02 '26

Interview, exam, or homework?

How much work have you done thus far to find the answer?

If your stored procedures (any code, really) are written correctly, adding a new column to a table should not affect them.

0

u/Dangerous_Word7318 Jun 02 '26

From sybase perspective new to sybase 

6

u/alinroc SQL Server DBA Jun 02 '26

Can you please re-read what I asked and try answering again?

1

u/Dangerous_Word7318 Jun 03 '26

It's not about effects just to know what table Dependency on stored procedure 

1

u/VisualExpert_Novalys 25d ago

For SQL Server, you can also look at Visual Expert (full disclosure, we develop it at Novalys).

It can show dependencies at different levels, including between schemas, tables, procedures and functions, right down to references in the code. You can also start from a table and use impact analysis to see what depends on it, directly or indirectly.

Here's an example from the documentation:
https://www.visual-expert.com/EN/visual-expert-documentation/code-cross-references/run-impact-analysis-tree-view-sql-server-tsql.html

1

u/SickInTheStyx Jun 02 '26

For Sybase, sp_depends should get you what you need. Note that this only returns results for stored procedures that have run at least once.

1

u/IanYates82 Jun 05 '26

Wow. Sybase. It's been a while!