Showing posts with label sys.sysobjects. Show all posts
Showing posts with label sys.sysobjects. Show all posts

Sunday, December 6, 2009

Find any keyword stored inside MS-Sql 'Function' or 'Procedure'.

Hi All,

As developer, one have frequently facing with problem of finding function or procedure in which they have made change. Here is how you will find out any keyword which you are looking for..

SELECT ROUTINE_NAME, ROUTINE_DEFINITION
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%KEYWORD%'
AND ROUTINE_TYPE='PROCEDURE' -- Write 'FUNCTION' to search in function.
ORDER BY ROUTINE_NAME

Happy Coding :-)

Monday, November 30, 2009

Find any Objects you have created in MS-SQL Server

Hi All,

before couple of hours i was looking for one of my user defined function, the misery is i forget its name( ... lazy developer habit), here is solution to my laziness.

SELECT name, id, xtype, uid, info, status, base_schema_ver, replinfo, parent_obj, crdate, ftcatid, schema_ver, stats_schema_ver, type, userstat, sysstat, indexdel, refdate,version, deltrig, instrig, updtrig, seltrig, category, cache
FROM sys.sysobjects

XTYPE =
‘U’ For table
‘PK’ For Primary Keys
‘F’ For Foreight Keys
‘V’ For views
‘P’ For stored procedures
‘TR’ For triggers
‘S’ For system objects
‘FN’ Function

It searches for all database objects.