Wednesday, May 26, 2010

Query to search text of all sql server database objects

here the sql query to search releated objects those includes this text:

select as [schema], as [Object],
so.type_desc as [objectType]
FROM sys.objects so
Inner join sys.schemas ss on ss.schema_ID = so.schema_Id
inner join syscomments sc On sc.Id = so.object_ID
where is_ms_shipped =0 ANd sc.text like '%test%'