程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> SqlServer數據庫 >> 關於SqlServer >> 列出 SQL Server 數據庫中所有的存儲過程

列出 SQL Server 數據庫中所有的存儲過程

編輯:關於SqlServer
Dim cn As rdoConnection

Dim ps As rdoPreparedStatement

Dim rs As rdoResultset

Dim strConnect As String

Dim strSQL As String

'利用 DSNless 連接到 pubs 數據庫

'改變參數以適合你自己的 SQL Server

strConnect = "Driver={SQL Server}; Server=myserver; " & "Database=pubs; Uid=sa; Pwd="

Set cn = rdoEnvironments(0).OpenConnection(dsName:="", Prompt:=rdDriverNoPrompt, ReadOnly:=False, Connect:=strConnect)

strSQL = "Select so.name,sc.name,st.name,sc.length " & "FROM syscolumns sc,master..systypes st,sysobjects so " & "WHERE sc.id in (select id from sysobjects where type ='P')" & " AND so.type ='P' " & "AND sc.id = so.id " & "AND sc.type = st.type " & "AND sc.type <> 39"

Set ps = cn.CreatePreparedStatement("MyPs", strSQL)

Set rs = ps.OpenResultset(rdOpenStatic)

list1.AddItem "SP Name,Param Name,Data Type,Length"

While Not rs.EOF

list1.AddItem rs(0) & " , " & rs(1) & " , " & rs(2) & " , " & rs(3)

rs.MoveNext

Wend

rs.Close

Set rs = Nothing

cn.Close

Set cn = Nothing

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved