由于今天剛接收一個新系統的維護,
今天突然接到一個需求,檢視一下這張表的資料來源,那麼我們該如何開始此項工作呢?
下文筆者講述,首先我們需查找資料表被哪些sql腳本使用,然後再進行下一步處理
--1.查詢某個表被哪些存儲過程使用到 :
select distinct object_name(id)
from syscomments
where id in (select object_id from sys.objects where type ='P')
and text like'%TableName%'
--2.查找那些過程對該表做了更新操作:
select distinct object_name(id)
from syscomments
where id in(select object_id from sys.objects where type ='P')
and text like'%update tablename%'