For Brian and yourself. Not that you said that you were accessing MS SQL Server but we have a tutorial which might prove useful for you at:
http://www.easysoft.com/products/9999/documentation/perl_tutorials/dbd_odbc_tutorial3.htm This is based on DBD::ODBC (which you do mention) and does explain how to get output parameters and procedure return values. Martin Quoting Brian Roy <[EMAIL PROTECTED]>: > On Tue, 1 Mar 2005 11:49:40 -0600, Moreno, Javier > <[EMAIL PROTECTED]> wrote: > > Hi all, > > > > This is probably a dumb question, but how do I run stored procedures with > the DBI? I am using DBD::ODBC. > > > > > my $dbh = DBI->connect("dbi:ODBC:server", 'name', 'password'); > my $query = "exec spTest "; > my $sth = $dbh->prepare($query); > $sth->execute(); > my $d = $sth->fetchrow_arrayref; > print "The result is", $d->[0], "\n" ; > > Now, that is very basic. The result is assuming that your stored > procedure returns something from a select statement. I have had a heck > of a time getting OUTPUT params to work and return anything so I stick > to selects. This is of course if you want anything returned. > > You are probably wanting to do more than that though. Take a look at > http://www.devarticles.com/c/a/SQL-Server/Executing-SQL-Server-Stored-Procedure-from-Perl/4/ > <-watch the wrapping > > That is for sybase, but the syntax is more or less the same. > > If anyone is willing to chime in on how to pull out OUTPUT params I > would love to have an example. I just gave up getting it to work. > > Hope this helps, >
