当前位置:Gxlcms > mysql > 存储过程或视图的字符串查询

存储过程或视图的字符串查询

时间:2021-07-01 10:21:17 帮助过:8人阅读

存储过程查询 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

,网站空间,香港空间,香港虚拟主机

人气教程排行