--檢視所有的觸發器中是否包含指定文字
select name,text from sysobjects t,syscomments m where type='tr' and m.id=t.id and text like '%t_fy_varylisting%' and t.name in (select name from sysobjects where name like 'tr%')
--檢視所有的儲存過程中是否包含指定文字
select name,text from sysobjects t,syscomments m where type='p' and m.id=t.id and text like '%t_fy_varylisting%' and t.name in (select name from sysobjects where name like 'p%')
--檢視依賴關係
sp_depends 'p_fy_count_changepro'
--檢視有沒有觸發器呼叫了儲存過程p_fy_count_changepro
select name,text from sysobjects t,syscomments m where type='tr' and m.id=t.id and t.name in (select name from sysobjects where name like 'tr%') and text like '%p_fy_count_changepro%'
--檢視儲存過程的文字
sp_helptext 'p_report_tz_bgtz'
--相關的表
select * from sys.sysdepends
select * from sys.procedures
--查詢所有的儲存過程的依賴關係
select a.name,c.name from sys.procedures as a
inner join sys.sysdepends as b on a.object_id = b.id
inner join sys.procedures as c on b.depid=c.object_id
where a.name='p_fy_count'
exec sp_helptext 'p_fy_count'
exec sp_helptext 'p_xt_idbuilder'
--查詢p_fy_count依賴的儲存過程
select name from sys.procedures
where object_id in (select distinct(depid) from sys.sysdepends
where id in (select object_id from sys.procedures where name='p_fy_count'))
--查詢依賴於p_fy_count的儲存過程
select name from sys.procedures
where object_id in (select distinct(id) from sys.sysdepends
where depid in (select object_id from sys.procedures where name='p_fy_count'))
/*p_fy_count p_xt_idbuilder
p_fy_count p_fy_delete_period
p_fy_count p_fy_count_changeprice
p_fy_count p_fy_count_dateworker
p_fy_count p_fy_count_jgtz
p_fy_count p_fy_count_progress
*/--檢視p_fy_count依賴的所有物件
select * from sysobjects where id in (select distinct(depid) from sys.sysdepends where id in(select object_id from sys.procedures where name='p_fy_count'))
更新資料庫物件依賴關係
在sql server 中我們會通過郵件選單來檢視乙個物件的依賴關係,但有些意外情況會造成檢視結果並不是非常的準確!可以嘗試以下例子 第一步 顛倒順序,建立乙個缺失依賴關係的儲存過程 code create proc dbo.testrefresh1 asexec dbo.testrefresh2 ...
查詢資料庫物件依賴關係
use testdb1 goselect distinct object name object id as objname from sys.sql dependencies where referenced major id object id dbo.tblprojects order by ...
物件 關聯式資料庫對映基礎
一 對映定義 1.doctype hibernate會先在classpath中尋找dtd檔案。然後是src下,最後會上網尋找。3.class 4.id 5.generator 6.composite id 7.鑑別器 discriminator 8.版本 version 9.timestamp 10...