列出数据库内所有的TRIGGER,STORE PROCEDURE
类别: ASP教程
<%
dbname = "databasename"
ConnStr = "provider=SQLOLEDB;network=DBMSSOCN;"
ConnStr = ConnStr & "uid=<uid>;pwd=<pwd>;server="
ConnStr = ConnStr & "<IP Address>;database=" & dbname
set Conn = server.createobject("adodb.connection")
Conn.Open ConnStr
set rs = Conn.execute("SELECT name FROM sysobjects WHERE xtype=\'TR\'") \'把TR换成p就可列出系统SP
\'<列出用户自建SP>set rs = Conn.execute("SELECT name FROM sysobjects WHERE xtype=\'P\' AND ObjectProperty(ID,\'IsMSShipped\')=0")
do while not rs.eof
response.write("<hr>" & rs(0) & "<br>")
set rs2 = Conn.execute("EXEC sp_helptext \'" & rs(0) & "\'")
do while not rs2.eof
response.write(rs2(0) & "<br>")
rs2.movenext
loop
rs.movenext
loop
rs.close: set rs = nothing
Conn.Close: set Conn = nothing
%>
dbname = "databasename"
ConnStr = "provider=SQLOLEDB;network=DBMSSOCN;"
ConnStr = ConnStr & "uid=<uid>;pwd=<pwd>;server="
ConnStr = ConnStr & "<IP Address>;database=" & dbname
set Conn = server.createobject("adodb.connection")
Conn.Open ConnStr
set rs = Conn.execute("SELECT name FROM sysobjects WHERE xtype=\'TR\'") \'把TR换成p就可列出系统SP
\'<列出用户自建SP>set rs = Conn.execute("SELECT name FROM sysobjects WHERE xtype=\'P\' AND ObjectProperty(ID,\'IsMSShipped\')=0")
do while not rs.eof
response.write("<hr>" & rs(0) & "<br>")
set rs2 = Conn.execute("EXEC sp_helptext \'" & rs(0) & "\'")
do while not rs2.eof
response.write(rs2(0) & "<br>")
rs2.movenext
loop
rs.movenext
loop
rs.close: set rs = nothing
Conn.Close: set Conn = nothing
%>
- 上一篇: 认识ASP内置的对象
- 下一篇: ASP中利用数组实现数据库记录的批量录入方法
-= 资 源 教 程 =-
文 章 搜 索