Tags

,

***************************************************
* search for a column name
***************************************************
SELECT sysobjects.name as “Table”,
syscolumns.name as “Column”
from sysobjects , syscolumns
where sysobjects.id = syscolumns.id
and sysobjects.xtype = ‘u’
and syscolumns.name like ‘%id%’
order by sysobjects.name, syscolumns.name

****************************************************

***************************************************
* search for a stored procedure
***************************************************
SELECT B.name AS ‘Schema’, A.name AS ‘Procedure Name’
FROM sys.sysobjects A join sys.schemas B
ON B.schema_id = A.uid
WHERE xtype=’P’ AND A.name LIKE ‘%Products%’
****************************************************

***************************************************
* find a stored procedure containing
***************************************************
SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE ‘%foobar%’
AND ROUTINE_TYPE=’PROCEDURE’
**************************************************

Advertisements