You are here: Re: Check if a Table is used in any sp or function « MsSQL Server « IT news, forums, messages
Re: Check if a Table is used in any sp or function

Posted by gjvdkamp on 07/23/06 17:52

Q. John Chen schreef:

> Hello, there,
>
>
> I am trying to find out if a table is used by any of the stored
> procedures or functions.
>
> I can generate all the scripts and look for it. But is there an easy
> way?
>
> THX
>
> John

Yep, there is:

CREATE proc [FindInObjects] (@Search varchar(300))
as

SELECT so.xtype, so.name, sc.TEXT
FROM dbo.syscomments sc RIGHT OUTER JOIN
dbo.sysobjects so ON sc.id = so.id
WHERE so.xtype IN ('P', 'V', 'FN', 'TR') AND (sc.TEXT LIKE '%' +
@Search + '%')

This will show you a list of all the objects that contain the search
string.

Enjoy,

GJ

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация