Skip to main content

Posts

Showing posts with the label sys

Find in which objects a particular word is used

Sometimes you have situation, where in you want to figure out which function a particular word / object is used in.  You can use the following query for this purpose. This query is useful if you want to search in which function a particular table is being used.    SELECT   OBJECT_NAME(id), TEXT    FROM     syscomments    WHERE    [text] LIKE '%proc_name%'   --          AND OBJECTPROPERTY(id, 'IsProcedure') = 1 You can also use this query for the purpose    SELECT *    FROM   sysobjects     WHERE name LIKE '%email%'

Find the Table Name

Ever came across a situation where you know a column name but don't remember the table name. This is the third incident that i forgot the table name and so thought of penning it down. How I Solved It? I will just share the queries that will help you get this done. I am sure that would be more than enough. Query 1:                              SELECT  *                              FROM    sys.columns                              WHERE   name LIKE   '%column_name%' This query will give you list of object_id and names that has the column name in it Using the object id we can find the object. Query 2:                              SE...