집 >데이터 베이스 >MySQL 튜토리얼 >存储过程 或视图的字符串查询
存储过程查询 SELECT a.name,b.text FROM sys.procedures a LEFT JOIN sys.syscomments b ON a.object_id = b.id WHERE b.text LIKE '%DEMO.DBO.RFI_StartOpr%' 视图查询 SELECT a.name,b.text FROM sys.views a LEFT JOIN sys.syscomments b ON a.object_id
存储过程查询
SELECT a.name,b.text FROM sys.procedures a LEFT JOIN sys.syscomments b ON a.object_id = b.id WHERE b.text LIKE '%DEMO.DBO.RFI_StartOpr%'
视图查询
SELECT a.name,b.text FROM sys.views a LEFT JOIN sys.syscomments b ON a.object_id = b.id WHERE b.text LIKE '%COPTD%'
CREATE TABLE #Proc
(
procname VARCHAR(200),
CONTENT VARCHAR(max)
)
DECLARE @procname VARCHAR(200)
DECLARE @temp VARCHAR(max)
DECLARE selectproc CURSOR SCROLL FOR
SELECT name FROM sys.procedures
OPEN selectproc
FETCH NEXT FROM selectproc INTO @procname
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC @temp = sp_helptext [PROC_MULKEY_Save_MultiOperQty]
PRINT @temp
INSERT #Proc ( procname, CONTENT )
VALUES ( @procname, @temp )
FETCH NEXT FROM selectproc INTO @procname
END
CLOSE selectproc
DEALLOCATE selectproc
SELECT * FROM #Proc WHERE CONTENT LIKE '%DEMO.DBO.RFI_StartOpr%'
--DROP TABLE #Proc
,网站空间,香港空间,香港虚拟主机