Not sharing query, but some tips that might be useful when looking for a needle in a haystack.
Am using Microsoft SQL Server 2000, but won't differ too much on later versions, I guess.
Find tables with the specified name
-----------------------------------
select name from sysobjects where name like '%table_name%' and type = 'u'
Find stored procedures with the specified name
----------------------------------------------
select name from sysobjects where name like '%sp_name%' and type = 'p'
Find the name of the tables which contain specified column
----------------------------------------------------------
select TableName = a.name, ColumnName = b.name from sysobjects a, syscolumns b
where a.id = b.id and b.name = 'column_name'
Find stored procedures which contain certain key / text
-------------------------------------------------------
select name from sysobjects where id in ( select id from syscomments where text like '%text_in_sp%')
This is also useful when you would like to search for stored procedures which uses a certain table.
e.g. If you would like to know the stored procedures which use the table named table_name,
select name from sysobjects where id in ( select id from syscomments where text like '%table_name%')
Friday, May 1, 2009
You may be intersted in
Related Posts
Updating Table Containing Xml Column via LinkedServer
If you are trying to update a table containing XML column via Linked Server in SQL Server, and you are not able to, you are not alone. There...
Thanks for your informations.
ReplyDeletegood post.