After reading through archives, DBD::Sybase man pages, Perl DBI, google,
etc., I finally tried the following and it worked:

my($statement) = 'exec myprocedure var1, var2';
my $sth = $dbh->prepare("$statement");
$sth->execute();
$sth->finish();

skipping the whole "do" thing, which somehow seems unnatural, but works.  If
anybody knows how to do it with "do", PLMK!

BTW, all of the info on the web pertaining to stored procedures is about
Oracle, IBM's DB2, and some odd & end DBs or proprietary services based on
one of these databases.  How come so scarce on the MS SQL / Sybase info?

Thanks K


-----Original Message-----
From: Jonathan Leffler [mailto:[EMAIL PROTECTED]]
Sent: Friday, June 21, 2002 12:04 PM
To: Karyn Ulriksen
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Where is the archive for this list?



If it were Informix, you'd use:
      execute procedure myprocedure($param1, $param2)
after worrying about whether the parameter values need to be quoted or not,
or:
      execute procedure myprocedure(?,?)
and provide the parameters when you execute the statement.  The backslashes
would be superfluous at best and erroneous at worst; the parentheses would
be necessary, as would the commas.

Since you're accessing MS SQL Server via DBD::Sybase and FreeTDS, I've no
idea what portion of my answer actually applies.  You probably need to find
the syntax for SQL Server (likely the same as for Sybase given the common
ancestry), and use that.

--
Jonathan Leffler ([EMAIL PROTECTED])
STSM, Informix Database Engineering, IBM Data Management Solutions
4100 Bohannon Drive, Menlo Park, CA 94025
Tel: +1 650-926-6921   Tie-Line: 630-6921
      "I don't suffer from insanity; I enjoy every minute of it!"


 

                      Karyn Ulriksen

                      <Karyn@Broadspire        To:       Jonathan
Leffler/Menlo Park/IBM@IBMUS, [EMAIL PROTECTED]                  
                      .com>                    cc:       [EMAIL PROTECTED]

                                               Subject:  Where is the
archive for this list?                                           
                      06/21/02 10:42 AM

 

 





I'd like to bookmark the mail archive site so that I don't have to go to
the
list to ask for the umpteenth million time what I know has been asked on
this list...

I'm having problems with calling an MS SQL stored procedure via DBI (using
FreeTDS DBD::Sybase).

I've tried the following formats:

$dbh->do("execute myprocedure $param1 $param2");
$dbh->do("execute myprocedure $param1, $param2");

$dbh->do("execute myprocedure \($param1, $param2 \)");
$dbh->do("execute myprocedure \($param1 $param2 \)");

Can someone throw me a bone?

K



Reply via email to