CREATE PROCEDURE [拥有者.]存储过程名[;程序编号] [(参数#1,…参数#1024)] [WITH {RECOMPILE (专业提供视频软件下载) ENCRYPTION (专业提供视频软件下载) RECOMPILE, ENCRYPTION} ] [FOR REPLICATION] AS 程序行 |
@参数名 数据类型 [VARYING] [=内定值] [OUTPUT] |
CREATE PROCEDURE order_tot_amt @o_id int,@p_tot int output AS SELECT @p_tot = sum(Unitprice*Quantity) FROM orderdetails WHERE ordered=@o_id |
select ID,Name,Picture,Time,Duty from employ |
CREATE PROCEDURE sp_employ AS select ID,Name,Picture,Time,Duty from employ Go |
select ID,Name,Picture,Time,Duty from employ where ID=10230 |
ALTER PROCEDURE sp_employ @inID int AS select ID,Name,Picture,Time,Duty from employ where ID=@inID Go |
<% dim Conn, strSQL, rs set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "DSN=webData;uid=user;pwd=password" strSQL = "select ID,Name,Picture,Time,Duty from employ " Set rs = Conn.Execute(strSQL) %> |
<% dim Conn, strSQL, rs, myInt myInt = 1 set Conn = Server.CreateObject("ADODB.Connection") Conn.Open "DSN=webData;uid=user;pwd=password" strSQL = "sp_myStoredProcedure " & myInt Set rs = Conn.Execute(strSQL) %> |
<!--必须加载adovbs.inc文件,否则将出错--> <!--#include file="adovbs.inc"--> <% dim objCnn dim objCmd dim Rs const o_id=112 '-----建立Connection对象---------- set objCnn=Server.CreateObject("Adodb.connection") objCnn.Open "driver={sql server};server=localhost;uid=sa;pwd=cncanet;database=check;" '-----建立Command对象----------- set objCmd=Server.CreateObject("Adodb.Command") objCmd.ActiveConnection=objCnn objCmd.CommandText="order_tot_amt" '指定存储过程名称 objCmd.CommandType=adCmdStoredProc '其为Stored Procedure '-----准备stored procedure 的参数------- objCmd.Parameters.Append _ objCmd.CreateParameter("o_id",adInteger,adParamInput,,o_id) objCmd.Parameters.Append _ objCmd.CreateParameter("p_tot",adBigInt,adParamOutput,,0) '-----执行存储过程---------------------- objCmd.Execute '-----输出参数以及处理结果-------------- for each parm in objCmd.Parameters Response.Write parm.name &"="& trim(parm) &"<br>" next %> |
……