Friday, March 23, 2012

procs that reference a table

In SQL Server 2000, I would like to find what stored procedures are accessing
a table.nm, got it.
SELECT name, xtype
FROM sysobjects
WHERE id IN (
SELECT id
FROM sysdepends
WHERE depid IN (
SELECT id
FROM sysobjects
WHERE name = @.Table
)
)
"JayKon" wrote:
> In SQL Server 2000, I would like to find what stored procedures are accessing
> a table.
>|||JayKon,
In an ideal world, you would have your answer, but the world is not always
ideal. Due to deferred name resolution, etc. the sysdepends table is not
always up-to-date. You might find Erland and Roy's comments in this thread
interesting on finding dependencies.
http://groups.google.com/group/microsoft.public.sqlserver.tools/browse_thread/thread/d8b39c5fd36ad806/6b64a938d50b3a68?lnk=st&q=ROY+HARVEY+SYSCOMMENTS&rnum=8&hl=en#6b64a938d50b3a68
RLF
"JayKon" <JayKon@.discussions.microsoft.com> wrote in message
news:77339A0F-1895-4856-A80C-EEB0151CF923@.microsoft.com...
> nm, got it.
> SELECT name, xtype
> FROM sysobjects
> WHERE id IN (
> SELECT id
> FROM sysdepends
> WHERE depid IN (
> SELECT id
> FROM sysobjects
> WHERE name = @.Table
> )
> )
> "JayKon" wrote:
>> In SQL Server 2000, I would like to find what stored procedures are
>> accessing
>> a table.

No comments:

Post a Comment