Code to get all the objects which contain a table name in its definition.
CREATE PROCEDURE GETSP_TABLENAME(@TABLENAME VARCHAR(200)) AS
BEGIN
SELECT DISTINCT OBJ.name OBJ_NAME,xtype AS OBJ_TYPE
FROM syscomments COM
INNER JOIN sysobjects OBJ ON OBJ.id=COM.id
WHERE com.TEXT LIKE '%TABLENAME%'
END
RUN BELOW CODE TO GET IF
EXEC GETSP_TABLENAME 'SYSOBJECTS'
No comments:
Post a Comment