Select Table using Column name
-----------------------------------------------------------------------------
SELECT c.name AS ColName, t.name AS TableName
FROM sys.columns c
JOIN sys.tables t ON c.object_id = t.object_id
WHERE c.name LIKE '%Column%'
Select Procedures using name
-----------------------------------------------------------------------------
SELECT DISTINCT
o.name AS Object_Name,o.type_desc
FROM sys.sql_modules m
INNER JOIN sys.objects o ON m.object_id=o.object_id
WHERE m.definition Like '%SP_Name%'
Query Your Database for a List of Triggers
-----------------------------------------------------------------------------
IF OBJECT_ID('sys.schemas') IS NULL
SELECT B.name + '.' + A.name
FROM sysobjects A, sysusers B
WHERE A.type = 'TR'
AND B.uid = OBJECTPROPERTY ( A.id , 'ownerid' )
ORDER BY A.name
ELSE
SELECT B.name + '.' + A.name
FROM sysobjects A, sys.schemas B
WHERE A.type = 'TR'
AND B.schema_id = A.uid
ORDER BY B.name + '.' + A.name
Query Your Database for a List of View
-----------------------------------------------------------------------------
SELECT *
FROM INFORMATION_SCHEMA.VIEWS
WHERE VIEW_DEFINITION like '%table%'
No comments:
Post a Comment