如何取得MSSQL中的存储过程的返回值
发表于:2007-07-02来源:作者:点击数:
标签:
声明存储过程 CREATE PROCEDURE sp_results_demo @InParmInt Int,@OutParmInt OUTPUT AS BEGIN SELECT 1,2,3,4 SELECT uid,id FROM sysobjects WHERE type=@#U@# SELECT @OutParmInt=69 Return 16 END 用于返回每个返回值时用PowerScrip如下: Long lReturn,
声明存储过程
CREATE PROCEDURE sp_results_demo @InParmInt Int,@OutParmInt OUTPUT
AS
BEGIN
SELECT 1,2,3,4
SELECT uid,id
FROM sysobjects
WHERE type=@#U@#
SELECT @OutParmInt=69
Return 16
END
用于返回每个返回值时用PowerScrip如下:
Long lReturn,lPram1,lPram2,lResult1,lResult2,lResult3,lResult4,lResult5,lResult6
DECLARE results_demo PROCEDURE FOR
@returnValue=sp_results_demo
@InParmInt = :lPram1,
@OutParmInt = :lPram2 OUTPUT using
sqlca;
execute results_demo;
Do While
SQLCA.SQLCode=0
Fetch results_demo INTO :lResult1,:lResult2,:lResult3,:lResult4 ;
Loop
Fetch results_demo INTO :lResult5,:lResult6 ;
Do While sqlca.sqlcode=0
Fetch results_demo Into :lResult5,:lResult6;
Loop
Fetch results_demo Into :lReturn,:lPram2;
Close results_demo ;
爱好者 wdw@gst.com.cn
mail to :imdt@263
.net
原文转自:http://www.ltesting.net