[英]Php Sql Server Stored Procedure
ALTER PROCEDURE [dbo].[uspProcessProfessionalPinRenewal]
@processtype INT ,
@SinglePinNumber NVARCHAR(12) = NULL,
@operatorID INT,
@returnMessage NVARCHAR(35) OUTPUT
AS
.....
$sqlExecSP = "{CALL uspProcessProfessionalPinRenewal(?,?,?,?)}";
//$sqlExecSP = "{CALL uspStudentGrading(?, ?, ?)}";
// Prepare stored procedure call with three parameters
$sth = $db->getPdo()->prepare($sqlExecSP);
$processtype=1;
$SinglePinNumber=$pin;
$operatorID=Auth::user()->BusinessEntityID;
$retMessage="";
// Bind parameter 1 as IN parameter
// Be sure *not* to set a length to indicate it's an IN parameter
$sth->bindParam(1, $processtype, PDO::PARAM_INT);
$sth->bindParam(2, $SinglePinNumber, PDO::PARAM_STR,12);
$sth->bindParam(3, $operatorID, PDO::PARAM_INT);
$sth->bindParam(4, $retMessage, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 35);
// $sth->bindParam(4, $indexnumber, PDO::PARAM_STR|PDO::PARAM_INPUT_OUTPUT, 50);
// dd($programcatid . ', ' . $programtypeid . ', ' . $voucherpin . ', ' . $applicationref);
// Call the stored procedure
// print "Executing stored procedure...\n";
$res = $sth->execute();
以上是我的存儲過程的標題和我調用它的php代碼
但是我收到錯誤 SQLSTATE[22018]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server] 將 nvarchar 值“17GS08664006”轉換為數據類型 int 時轉換失敗。
請幫忙
通過存儲過程,我意識到我正在將一個字符串分配給一個整數。 非常感謝
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.