Perl Library to execute stored procedures in MS-SQL Server 
Author Message
 Perl Library to execute stored procedures in MS-SQL Server

Hello,

I am trying to write Perl wrapper to run stored procedure in MS SQL
Server. I am looking at the following two Perl modules:

(1) Win32::ODBC
(2) MSSQL::SQLLIB

Here are my requirements:

(1) I need to capture result data set from stored procedures
(2) I need to capture return codes from stored procedures

Unless I am doing wrong, I am unable to capture both result set and
return code from MS SQL Server using those two Perl modules. Can you
point out to me as to what other Perl modules are available to fulfill
my requirements or what I am doing incorrectly.

Here are a few things I learned about those two Perl modules:

(1) Win32::ODBC
It is good at capturing result data set from running SQL statements
such as SELECT, INSERT, UPDATE, and DELETE but not result data set
from stored procedures calls. It does not work for me.

(2) MSSQL::SQLLIB
It has 'sql_sp' function which requires special way of passing
parameters and my stored procedure calls are dynamic with unknown
number of parameters until run-time. It does not work for me.

Thank you,

Ye H. Aung
Database Administrator
Nicholas Applegate Capital Management
San Diego, California
Tel: (619) 652-5417



Mon, 08 Aug 2005 16:11:38 GMT  
 Perl Library to execute stored procedures in MS-SQL Server

Quote:
> Hello,

> I am trying to write Perl wrapper to run stored procedure in MS SQL
> Server. I am looking at the following two Perl modules:

Have you tried DBD::Sybase (yes this does work with MS SQL), this can
execute stored procedures.

$sql = 'exec my_proc';
$sth=$dbh->prepare($sql);
and so on in the DBI manner.

--
Stephen Patterson http://www.lexx.uklinux.net http://patter.mine.nu

Linux Counter No: 142831 GPG Public key: 252B8B37        
Last one down the pub's an MCSE



Mon, 08 Aug 2005 20:33:38 GMT  
 Perl Library to execute stored procedures in MS-SQL Server

Quote:

> Hello,

> I am trying to write Perl wrapper to run stored procedure in MS SQL
> Server. I am looking at the following two Perl modules:

> (1) Win32::ODBC
> (2) MSSQL::SQLLIB

Instead of those, try using DBI.pm, and DBD::Sybase.
   use DBI ();
   use DBD::Sybase ();
   my $dsn = "DBI:Sybase:...";
   my $dbh = DBI->connect(
       $dsn, $userid, $password,
       { RaiseError => 1 },
   ) or die $DBI::errstr;
   my $sth = $dbh->prepare(q[
      exec my_procedure(?, ?, ?, ?);
   ]);
   $sth->execute( $arg1, $arg2, $arg3, $arg4 );


   }
   __END__
[untested]

--
$;=qq qJ,krleahciPhueerarsintoitq;sub __{0 &&
my$__;s ee substr$;,$,&&++$__%$,--,1,qq;;;ee;
$__>2&&&__}$,=22+$;=~y yiy y;__ while$;;print



Wed, 10 Aug 2005 21:13:19 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Executing DEL and UPDT PL/SQL stored procedures from PERL

2. Executing DEL and UPDT PL/SQL stored procedures from PERL

3. Perl and MS SQL Server Stroed Procedures

4. LONG: Req: Help in retrieving values from SQL Server stored procedure using Win32::ODBC

5. ODBC, SQL Server, Stored Procedures

6. ODBC, SQL Server, Stored Procedures

7. Executing MSQL stored procedure from perl

8. SQL 2000 Stored procedure called from PERL not responding

9. Using Embedded SQL vs Stored procedures in Perl DBI?DBD for Oracle

10. Using SQL stored procedure in Perl

11. Executing Stored Procedures using Win32::ODBC

12. Oraperl - executing stored procedures

 

 
Powered by phpBB® Forum Software