keyongtech


  keyongtech > php

 #1  
03-26-08, 04:46 PM
David Gillen
Hello.

I'm having difficulty getting the value of output parameters from stored
procedures on a SQL server.
I understand that this just doesn't work with odbc so I've tried both the
mssql functions route, and the PDO route. In both instances I can execute the
query and iterate over the result set, but in both cases the variable bound to
the output parameter isn't having it's value changed.

In my searches online I've come across examples of how it 'should' work, and
plenty of posts of people unable to get it to work. Is there something special
that needs to be done to have it set?

The bind calls I'm trying are (mssql and PDO respectively)
mssql_bind($stmt, '@Output', $output, SQLINT4, true);
and
$stmt->bindParam(2, $OutPut, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT, 16);

I'm hoping someone can maybe shed some light on this, or at least point me in
a direction which has eluded me thus far.

Thanks,
David.
 #2  
03-27-08, 05:10 PM
Erwin Moller
David Gillen schreef:
[..]
> The bind calls I'm trying are (mssql and PDO respectively)
> mssql_bind($stmt, '@Output', $output, SQLINT4, true);
> and
> $stmt->bindParam(2, $OutPut, PDO::PARAM_INT|PDO::PARAM_INPUT_OUTPUT, 16);
>
> I'm hoping someone can maybe shed some light on this, or at least point me in
> a direction which has eluded me thus far.
>
> Thanks,
> David.


Hi David,

This might help a little:
http://blog.stuartherbert.com/php/20...-2005-support/

The lower section named:
What’s Wrong With The Existing MSSQL Extension For PHP?

Also, M$ is making a new driver, read more here:
http://www.microsoft.com/Sqlserver/2...hp-driver.aspx

Maybe it helps using their new version.
I am NOT sure because I didn't try it yet, but read some good reviews.
If that is an option for you: Give it a shot

Please report back here with your experiences.

Regards and good luck,
Erwin Moller
 #3  
03-28-08, 10:04 AM
David Gillen
On Thu, 27 Mar 2008 Erwin Moller wrote:
> David Gillen schreef:
>> Hello.
>>
>> I'm having difficulty getting the value of output parameters from stored
>> procedures on a SQL server.


[SNIP]

> Hi David,
>
> This might help a little:
> [..]
>
> The lower section named:
> What’s Wrong With The Existing MSSQL Extension For PHP?
>
> Also, M$ is making a new driver, read more here:
> [..]
>
> Maybe it helps using their new version.
> I am NOT sure because I didn't try it yet, but read some good reviews.
> If that is an option for you: Give it a shot
>
> Please report back here with your experiences.
>

Hi Erwin,
Thanks for the response. Was just checking here to post progress.
Using the SqlCommand class from the URL below I've managed to very quickly get
the results back and the output parameters working. It depends on the pear DB
library, which while deprecated in favour of MDB2 is doing the job.
http://articles.sitepoint.com/articl...oft-sql-server
I'd recommend this for anyone trying to get output parameters to work with
SQLServer.

Unfortunately in this instance my access to the servers is very limited so
it's unlikely I'll be able to get that new driver installed, however I've book
marked it and will likely try it out in the near future.

Thanks,
David.
Similar Threads
Thread Thread Starter
Stored Procedure with Output Parameters

Hi all I'm tryng to use MSDAORA access in a Oracle 9 database. I have a stored procedure named TEST with this Sign : PROCEDURE TEST ( PC_01 IN VARCHAR2 ,PC_02...

eny
Using Output Parameters from SQL Server Stored Procedure to ASP.NET SQLCommand

im new to SQL Server and ASP.Net. Here's my problem. I have this SQL Server stored procedure with an input parameter and output parameter CREATE PROCEDURE...

Mr Not So Know It All
Getting OUTPUT parameters from another stored procedure

OK, here is what I have. Proc1 defines some variables within it, say one is @Amount1 and @Amount2. (These are not parameters passed to proc1, they are variables within...

standish22
Output Parameters set by Stored procedure

HI, Trying to set a Global Variable using output from a stored procedure. I'm using a row value. The stored procedure variable is declared as varchar(200). The Global...

rob.beckman
Stored Procedure Output Parameters

I have a Stored procedure in SQL, that works, when tested in SQL, with one input & several output parameters, as follows: CREATE PROCEDURE myProcedure @MyID int , @First...

Bari Allen

Privacy Policy | All times are GMT. The time now is 04:23 PM.

Merging Information Logo
[Deutschland] [España] [France] [Italia] [Nederland] [Polska] [United Kingdom]