---查找引用
SELECT * FROM sys.all_sql_modules a
JOIN sys.objects b ON a.object_id = b.object_id
WHERE definition LIKE '%Order%'
--显示表属性
SELECT A.name AS table_name,B.name AS column_name,C.value AS column_description
FROM sys.tables A
INNER JOIN sys.columns B ON B.object_id=A.object_id
LEFT JOIN sys.extended_properties C ON C.major_id=B.object_id AND C.minor_id=B.column_id
WHERE A.name IN ('Order')
ORDER BY A.name DESC
--查找存储过程被那些job使用
SELECT *
FROM msdb.dbo.sysjobs JOB WITH( NOLOCK)
INNER JOIN msdb. dbo.sysjobsteps STP WITH(NOLOCK )
ON STP.job_id = JOB .job_id
WHERE STP.command LIKE N'%JOB_Order%'