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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 SP_DEPENDS

Author  Topic 

vision.v1
Yak Posting Veteran

72 Posts

Posted - 2010-06-25 : 12:28:29
Hi,

How can i find out list of stored procedure, functions which will refer to a particular table.

I would like to find out the list of stored procedures & functions not only in the current database but also which are present is another databases

For eg. if we write the following:

sp_depends Employee

It will display name and type of the object only in the current database, but i want the list which are present in another database

please give suggestions

Thanks

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2010-06-25 : 14:21:29
I don't know of a tool that does that does this. We make use of a GREP like tool from RedGate named SQL Search that searches through the object definitions for a specific string (e.g., "Employee"). You would need to know where to apply your searches. The tool was free but was also targeted for commercialization so it may be charged for now.

=======================================
A couple of months in the laboratory can save a couple of hours in the library. -Frank H. Westheimer, chemistry professor (1912-2007)
Go to Top of Page

vision.v1
Yak Posting Veteran

72 Posts

Posted - 2010-06-27 : 05:05:36
quote:
Originally posted by Bustaz Kool

I don't know of a tool that does that does this. We make use of a GREP like tool from RedGate named SQL Search that searches through the object definitions for a specific string (e.g., "Employee"). You would need to know where to apply your searches. The tool was free but was also targeted for commercialization so it may be charged for now.

=======================================
A couple of months in the laboratory can save a couple of hours in the library. -Frank H. Westheimer, chemistry professor (1912-2007)



Thanks for reply... don't we have any sql command in sql server 2005 like SP_DEPENDS
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-06-27 : 06:22:41
sp_depends is in SQL 2005, but it's only for dependencies in the current database, and it's so often wrong as to be near useless. If you want cross-database dependencies, you'll need a third party tool or really complex hand-written scripts.

--
Gail Shaw
SQL Server MVP
Go to Top of Page

urzsuresh
Starting Member

30 Posts

Posted - 2010-06-28 : 02:24:47
quote:
Originally posted by vision.v1

Hi,

How can i find out list of stored procedure, functions which will refer to a particular table.

I would like to find out the list of stored procedures & functions not only in the current database but also which are present is another databases

For eg. if we write the following:

sp_depends Employee

It will display name and type of the object only in the current database, but i want the list which are present in another database

please give suggestions

Thanks

Hello Friend,
Kindly try below query
SELECT Name
FROM sys.procedures
WHERE OBJECT_DEFINITION(object_id) LIKE '%TableName%'





Suri
Go to Top of Page

vision.v1
Yak Posting Veteran

72 Posts

Posted - 2010-06-28 : 06:30:07
quote:
Originally posted by urzsuresh

quote:
Originally posted by vision.v1

Hi,

How can i find out list of stored procedure, functions which will refer to a particular table.

I would like to find out the list of stored procedures & functions not only in the current database but also which are present is another databases

For eg. if we write the following:

sp_depends Employee

It will display name and type of the object only in the current database, but i want the list which are present in another database

please give suggestions

Thanks

Hello Friend,
Kindly try below query
SELECT Name
FROM sys.procedures
WHERE OBJECT_DEFINITION(object_id) LIKE '%TableName%'





Suri



No luck...Displaying 0 records
Go to Top of Page

dvdtknsn
Starting Member

2 Posts

Posted - 2010-06-29 : 17:36:21
SQL Search is completely free to use. There may be a commercial version at some point in the future but I can confirm that there there are no plans to disable the free version.

At the moment you can search a specific database or all databases on your instance. There is a feature request on the backlog to specify a subset of databases, but I can't tell you when this might be implemented. Please post any enhancement requests to the Red Gate support forums.

http://www.red-gate.com/products/sql_search/index.htm

Kind regards,

David Atkinson
Red Gate Software
Go to Top of Page
   

- Advertisement -