freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
[freetds] Need help with SQL server stored procedure output?
- From: "Gaurav Nangia" <gnangia AT mspintl.com>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: [freetds] Need help with SQL server stored procedure output?
- Date: Fri, 18 Jul 2003 12:04:22 -0400
Hi all,
I am using freetds 0.61 with DBD::Sybase on Redhat linux to connect to SQL
Server 7.0. Connection works fine and I can run select statments to do
queries against any of the databases. However, I am having an issue with
running a stored procedure that RETURNS A VALUE. How do I retrieve that
value. I would appreciate if somebody could provide some insight. So far
the gist of my program is as follows -
TEST Stored Procedure that was created -
CREATE PROCEDURE TEST @results numeric(9,4) OUTPUT
AS
BEGIN
SELECT @results = 9999.9999
END
Here is the sql statement I use to retrieve the result at a sql command
line.
declare @mytest numeric(9,4)
exec TEST @results=@mytest OUTPUT
print @mytest
Now here is the perl script that I use
#!/usr/bin/perl
use DBI;
$dbh = DBI->connect('DBI:Sybase:server=DEV;', $user, $passwd) or die "Cannot
connect:$@\n";
$sql = ("declare \@test numeric(9,4) exec TEST \@results=\@test OUTPUT");
$sth=$dbh->prepare($sql);
$sth->execute;
while(@d = $sth->fetchrow_array)
{
foreach $xyz(@d)
{
print "REsult=>$xyz<=\n";
}
}
This should print the hardcoded value 9999.9999 but prints out 0 which I
think is a successful return code. Can anyone please help me out.
Regards,
Gaurav
-
Re: [freetds] RPC/Packet Type 3 Format
, (continued)
-
Re: [freetds] RPC/Packet Type 3 Format,
lists-tds, 07/21/2003
- Re: [freetds] RPC/Packet Type 3 Format, Frediano Ziglio, 07/22/2003
-
RE: [freetds] RPC/Packet Type 3 Format,
Lowden, James K, 07/17/2003
- RE: [freetds] RPC/Packet Type 3 Format, lists-tds, 07/17/2003
- RE: [freetds] RPC/Packet Type 3 Format, lists-tds, 07/17/2003
-
RE: [freetds] RPC/Packet Type 3 Format,
Lowden, James K, 07/17/2003
- RE: [freetds] RPC/Packet Type 3 Format, lists-tds, 07/17/2003
- RE: [freetds] RPC/Packet Type 3 Format, Lowden, James K, 07/17/2003
-
RE: [freetds] RPC/Packet Type 3 Format,
Lowden, James K, 07/17/2003
-
RE: [freetds] RPC/Packet Type 3 Format,
lists-tds, 07/18/2003
- [freetds] Need help with SQL server stored procedure output?, Gaurav Nangia, 07/18/2003
-
RE: [freetds] RPC/Packet Type 3 Format,
lists-tds, 07/18/2003
- RE: [freetds] RPC/Packet Type 3 Format, Lowden, James K, 07/18/2003
-
RE: [freetds] RPC/Packet Type 3 Format,
Thompson, Bill D (London), 07/21/2003
- RE: [freetds] RPC/Packet Type 3 Format, Frediano Ziglio, 07/21/2003
- RE: [freetds] RPC/Packet Type 3 Format, Thompson, Bill D (London), 07/22/2003
-
Re: [freetds] RPC/Packet Type 3 Format,
lists-tds, 07/21/2003
Archive powered by MHonArc 2.6.24.