sqlserver查詢表是否有被視圖引用

在開發過程當中,若是咱們有使用到視圖,那麼咱們若是修改了表結構,通常咱們都須要對應修改視圖。視圖太多,可使用下面語句查詢,避免遺漏。開發

select distinct object_name(id) from syscomments 
where id in (select id from sysobjects where type  in('V','P')) 
and text like '%表名%'object

相關文章
相關標籤/搜索