It's Not A Bug, It's A Feature Just another Developer weblog

14Jun/100

List All Stored Proc Parameters for a Stored Procedure

Here is a simple little script that will list all of a stored procedures parameters. making it easy for you to write your execution code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
<table>
    <tr>
        <td>Param Name</td>
        <td>Param Type</td>
        <td>Param Dir</td>
        <td>Param Size</td>
    </tr>
    <%
    Set Conn = Server.CreateObject("ADODB.Connection")
    ' The following line must be changed to reflect your data source info
    Conn.Open "PROVIDER=SQLOLEDB;Data Source=127.0.0.1;UID=MyUsername;PWD=MyPassword;DATABASE=MyDataBase"
    set cmd = Server.CreateObject("ADODB.Command")
    cmd.ActiveConnection = Conn
    'Specify the name of the stored procedure you wish to call
    cmd.CommandText = "MyStoreProcedure"
    cmd.CommandType = 4
    cmd.Execute
    ' Query the server for what the parameters are
    cmd.Parameters.Refresh
    For Each param In cmd.Parameters
   %>
    <tr>
        <TD><%= param.name %></TD><TD> <%= param.type %></TD><TD> <%= param.direction %></TD><TD><%= param.size %></TD>
    </tr>
   <%
    Next
    Conn.Close
   %>
   </TABLE>
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)


*

No trackbacks yet.