Home > Database > Mysql Tutorial > 存储过程 或视图的字符串查询

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

WBOY
Release: 2016-06-07 17:44:14
Original
1027 people have browsed it

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

,网站空间,香港空间,香港虚拟主机
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template