Relationship stored procedures and tables

1. queries a table which is a stored procedure (hereinafter referred to as SP) use:

 select distinct object_name(id) fromsyscomments where id in

 (select object_id from sys.objects where type='P') and text like'%TableName%'

 

2. Find the table that process did update:

 select distinct object_name(id) fromsyscomments where id in

 (select object_id from sys.objects where type='P') and text like'%update tablename%'

 

3. All current database query SP:

 select name as stored procedure fromsysobjects where type = 'P'

 

 

 

-------------------------------------------------- example of use ----------------------- ------------------------- -------------------------------------------------- -----

 

 SELECT DISTINCT         OBJECT_NAME(id)  FROM   syscomments  WHERE  id IN ( SELECT  object_id                 FROM    sys.objects                 WHERE   type = 'P' )         AND text LIKE '%t_Supplier%'   go

 SELECT DISTINCT         OBJECT_NAME(id) FROM syscomments  WHERE  id IN ( SELECT  object_id                 FROM    sys.objects                 WHERE   type = 'P' )         AND text LIKE '%update t_Supplier%'

 

 SELECT *  FROM   dbo.t_TableDescription  WHERE  FTableName LIKE '%供应商%'

--存储过程 /* yxyz_YFKHZ_DemoNew_czq GetItemDetailByID p_ICPlan_ICClassProfileAdjust_ColWidth_ColOrder PoSupplyerPriceAnalyse GetItemDetail p_UpdateSupplyInfoByImpOrd Rpt120 PrintItemClass p_BM_PurPayBudgetImp yxyz_YFMX Rpt170 yxyz_YFKHZ_Demo p_UpdateSupplierFID PoOrderAbcAnalyse p_BM_PurchaseBudgetImport GetItemDetailByName Rpt119 PRC_ShopGenNoteCitation sp_K3_insertoutsourceWarehousing sp_tb_icstockbill_1Auto_ICPurchase PRC_GenNoteCitation GetBaseDetail ICScmInfoUsed PoSupplyerAbcAnalyse */

 

Guess you like

Origin www.cnblogs.com/qiu18359243869/p/10983640.html