I am trying to call a MS SQL SP from a php script. When I tried calling the procedure which required an parameter as input (hardcoded the parameter for now ), it failed. The code is below:
$link = mssql_connect('xx.xx.xx.xx', 'xx', 'xx');
$report_id=79;
$proc=mssql_init ('usp_IVR_FormatImportData', $link );
mssql_bind ($proc, '@ReportID', $report_id, SQLINT4, FALSE);
mssql_execute ($stmt);
The error I got is this:
PHP Warning: mssql_execute (): message: Conversion failed when converting the varchar value ':2' to data type int. (severity 16) in /var/lib/asterisk/wbrivr/scripts/test.php on line 24
PHP Warning: mssql_execute(): stored procedure execution failed in /var/lib/asterisk/wbrivr/scripts/mobin3.php on line 24
The same code works fine when I need to call an SP with no input parameters so I am wondering if it is a parameter mismatch or something as indicated by 开发者_如何学Gothe error line. I am running php 5.1.6 and the server is SQL Server 2008.
Running just this line of code below also gives the same error.
mssql_query("exec usp_IVR_FormatImportData 79", $conn);
Check the Data type
or
Convert it.
精彩评论