Tuesday, July 14, 2015

Query for finding the table exists in definition or codes of objects.

Query for finding the table exists in different definition or codes of objects.

For example if you want to delete or obsolete any table you will first check if exist in
any object code. If you wont correct that code that object will throw error after
deleting the table.


SELECT DISTINCT obj.name, obj.type
FROM syscomments COM
INNER JOIN sys.objects OBJ ON com.id=obj.object_id
WHERE COM.TEXT LIKE '%Tablename%'

You can create the sp using this code which will return list of object having table

name in code.

Check out Video below...

No comments:

Post a Comment