G
geoffrobinson
I have a stored procedure I need to call and get a value back from an
input/output parameter. The stored procedure is on a SQL Server 2005
DB. The first parameter is a varchar parameter. The second is a inout
variable which is returning a decimal value.
Via, SQL Server tools I would call it like this:
exec spMyStoredProcedure 'some string', @varname OUTPUT
So after research and tinkering the best code I could come up with is:
my $var1;
my $statement = "exec spMyStoredProcedure '?', ? OUTPUT";
my $sth-> $dbh->prepare($statement);
$sth->bind_param(1, "some string");
$sth->bind_param_inout(2, \$var1, 50);
$sth->execute();
$sth->finish();
The above code is giving me an error that I "can't bind unknown
placeholder '2'. I tried removing the quotes from the first question
mark, and I got a different error. The statement could not be
prepared.
If anyone has any insight into what is wrong, I would greatly
appreciate any help you can give me.
thanks,
Geoff
input/output parameter. The stored procedure is on a SQL Server 2005
DB. The first parameter is a varchar parameter. The second is a inout
variable which is returning a decimal value.
Via, SQL Server tools I would call it like this:
exec spMyStoredProcedure 'some string', @varname OUTPUT
So after research and tinkering the best code I could come up with is:
my $var1;
my $statement = "exec spMyStoredProcedure '?', ? OUTPUT";
my $sth-> $dbh->prepare($statement);
$sth->bind_param(1, "some string");
$sth->bind_param_inout(2, \$var1, 50);
$sth->execute();
$sth->finish();
The above code is giving me an error that I "can't bind unknown
placeholder '2'. I tried removing the quotes from the first question
mark, and I got a different error. The statement could not be
prepared.
If anyone has any insight into what is wrong, I would greatly
appreciate any help you can give me.
thanks,
Geoff