I'm trying to run a sql server procedure that returns me a variable. The procedure, for example has the following structure:
CREATE PROCEDURE SP_TESTE
@ID INT,
@REFERENCIA INT OUTPUT
AS
SELECT @REFERENCIA = ID_REFERENCIA
FROM REFERENCIA WHERE ID_REFERENCIA = @ID;
RETURN
GO
In SQL ManagementStudio, I use the following query to return the OUTPUT of my SP:
DECLARE @REF INT
EXEC SP_TESTE 1,@REFERENCIA = @REF OUTPUT
SELECT @REF AS REFERENCIA
Now I would like to know how to pass this query to be executed in PHP, using the driver for sql server, sqlsrv_query, for example. But in sqlsrv_query I'm only able to execute one statement at a time.