Home > php教程 > php手册 > body text

解析:php调用MsSQL存储过程使用内置RETVAL获取过程中的return值

WBOY
Release: 2016-06-13 11:43:28
Original
1228 people have browsed it

【PHP代码】

复制代码 代码如下:


 $stmt = mssql_init('P__Global_Test', $conn) or die("initialize stored procedure failure");
 mssql_bind($stmt, "RETVAL", $returnValue, SQLINT4, true);
 mssql_execute($stmt, false);
        if( $returnValue == 0 ){
           echo 'ABCD';
        }
        else{

           echo 'EFGH';
Copy after login


【存储过程】

复制代码 代码如下:


CREATE PROCEDURE dbo.P__User_JudgeResume(
)
set nocount on
 set @Message = ''

 if not exists( select * from _Test )
 begin
  return 0
 end
 else
 begin
  return 1
 end
set nocount off
GO


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template