1. 程式人生 > >查詢儲存過程內容

查詢儲存過程內容

參考:https://www.cnblogs.com/coce/p/8052574.html

 

 1 WITH proc_temp AS (
 2 SELECT Pr_Name AS spName
 3 FROM ( SELECT Pr.name AS Pr_Name ,
 4 parameter.name + ' ' + Type.name + ' ('
 5 + CONVERT(VARCHAR(32), parameter.max_length) + ')' AS Parameter
 6 FROM sys.procedures Pr
 7 LEFT JOIN sys.parameters parameter ON
Pr.object_id = parameter.object_id 8 INNER JOIN sys.types Type ON parameter.system_type_id = Type.system_type_id 9 WHERE type = 'P' 10 ) tb 11 WHERE Pr_Name NOT LIKE 'sp_%' --and Pr_Name not like 'dt%' 12 GROUP BY Pr_Name 13 ) 14 SELECT spName, (SELECT TOP 1 TEXT FROM syscomments WHERE id=object_id
(spName) AND TEXT LIKE'%表卡新增%') AS sp_text INTO #temp_sp FROM proc_temp; 15 16 SELECT * FROM #temp_sp WHERE sp_text IS NOT NULL; 17 18 DROP TABLE #temp_sp;