Re: Calling a SQL Server Stored Procedure from within Perl
- From: smallpond <smallpond@xxxxxxxx>
- Date: Wed, 21 Nov 2007 09:52:40 -0800 (PST)
On Nov 21, 10:41 am, ab <absmi...@xxxxxxxxxxx> wrote:
Hi,
I'm trying to call a simple Stored Procedure from within my Perl
script. I tested the SP named "usp_test" in the Query Analyzer and it
ran OK. My perl script looks like this
use Win32::ODBC;
if (!($MyDB = new Win32::ODBC("DSN=MyDSN;UID=MyLoginID;PWD=MyPwd;")))
{
print "Error: Unable to connect to the database\n";
exit;
}
The connection is OK, I've tested it by listing all the rows in a test
table. Now I have to call the SP. I tried something like this but that
didn't work:
my $sth = $MyDB -> prepare("EXEC usp_test");
$sth -> execute;
Any information is welcome.
Thanks,
Ab
I have yet to see any computer program print the error message:
"didn't work" yet people persist in claiming that is the
result of running their program. Software vendors go to great
lengths to return useful error indicators, so why not use them?
$rv = $h->err;
"Returns the native database engine error code from the last
driver method called. The code is typically an integer but
you should not assume that."
--S
.
- Follow-Ups:
- Re: Calling a SQL Server Stored Procedure from within Perl
- From: Keith Keller
- Re: Calling a SQL Server Stored Procedure from within Perl
- From: Jürgen Exner
- Re: Calling a SQL Server Stored Procedure from within Perl
- References:
- Prev by Date: Re: is there any command for catch in tcl in perl
- Next by Date: Re: Calling a SQL Server Stored Procedure from within Perl
- Previous by thread: Calling a SQL Server Stored Procedure from within Perl
- Next by thread: Re: Calling a SQL Server Stored Procedure from within Perl
- Index(es):
Relevant Pages
|