Estoy intentando ejecutar un procedimiento almacenado en SQL Server 2000 desde php 5 instalado en un Linux (Debian).
El mensaje de error es el siguiente:
Código PHP:
Warning: mssql_execute() [function.mssql-execute]: stored procedure execution failed in /var/www/web/intranet/recogida.php on line 239
Código PHP:
$conSQL = mssql_connect('IP-Servidor','usuario','password') or die ("No se puede conectar a SQL Server.");
mssql_select_db("DBName",$conSQL);
$stmt = mssql_init("expediente",$conSQL);
mssql_bind($stmt,"RETVAL",&$exp_num,SQLINT2);
mssql_execute($stmt);
unset($stmt);
Cita:
El procedimiento almacenado funciona perfectamente ejecutándolo desde SQL Server...CREATE procedure expediente as
declare @num int
declare @Error int
begin tran
select @num = num_expe from tabla
update tabla set num_expe = num_expe + 1
SET @Error=@@ERROR
if (@Error<>0) goto TratarError
commit tran
TratarError:
if @@Error<>0
begin
rollback tran
select @num = -1
end
return(select @num)
GO
declare @num int
declare @Error int
begin tran
select @num = num_expe from tabla
update tabla set num_expe = num_expe + 1
SET @Error=@@ERROR
if (@Error<>0) goto TratarError
commit tran
TratarError:
if @@Error<>0
begin
rollback tran
select @num = -1
end
return(select @num)
GO
Muchas gracias por su respuesta.
Un saludo.