Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sanjnep
Posting Yak Master
191 Posts |
Posted - 2007-11-13 : 10:10:20
|
I want to find the table name within a database which is being used by any store procedure within this database. Is there any script to do this?ThanksSanjeev |
|
sshelper
Posting Yak Master
216 Posts |
Posted - 2007-11-13 : 10:25:37
|
You can try the sp_depends system stored procedure. Just pass the name of the table as a parameter and it will show you the objects referencing this table:EXECUTE [dbo].[sp_depends] 'YourTable'SQL Server Helperhttp://www.sql-server-helper.com |
 |
|
sanjnep
Posting Yak Master
191 Posts |
Posted - 2007-11-13 : 10:33:59
|
Thanks a LOT |
 |
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2007-11-13 : 10:50:03
|
Be aware that will not locate tables referenced in dynamic SQL statements.The foolproof method is simply to script out all your code and do a text search for the table name.e4 d5 xd5 Nf6 |
 |
|
sql_er
Constraint Violating Yak Guru
267 Posts |
Posted - 2007-11-15 : 10:06:59
|
Check this out: http://www.sqlservercentral.com/Forums/Topic333827-5-1.aspx |
 |
|
craig79
Starting Member
33 Posts |
Posted - 2007-11-23 : 11:55:44
|
Try this..select * from dbo.syscommentswhere text like '%%' -- put table name within the single quotes.. |
 |
|
evilDBA
Posting Yak Master
155 Posts |
Posted - 2007-11-23 : 12:32:20
|
select * from dbo.syscommentswhere text like '%%' -- put table name within the single quotes..This statement works in 99.9% of cases.Syscomments are stored in chunks, so if table name crosses the boundary this query will not find it. |
 |
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2007-11-24 : 10:15:12
|
Right. It won't find all the references in a very large stored procedure.e4 d5 xd5 Nf6 |
 |
|
|
|
|