r/SQL • u/Dangerous_Word7318 • 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 :
Sql Server
Sybase
1
Upvotes
3
u/Eleventhousand Jun 02 '26
For SQL Server, you should be able to use something like:
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.
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!