executing MS SQL Server stored procedures

From: Perldiscuss - Perl Newsgroups And Mailing Lists (pothier.ra_at_forces.gc.ca)
Date: 07/16/04


Date: 16 Jul 2004 14:52:10 -0000
To: dbi-users@perl.org

I am trying to run an MS SQL server stored procedure using Perl.
We are using SQL Server 2000. Using the current Perl and DBI.
Can I use the ODBC DBD?
I am using a prepare,execute and fetch.
Has anyone tried this and do you have examples or how to do this?
I use the 'exec' command but get syntax errors on the execute for the
parameters provided. The prepare doesn't produce any errors.

my $query = "exec sp_query @criteria = 0";
my $sth = $dbh->prepare($query);
$sth->execute();



Relevant Pages

  • Re: How to access MS Access from Perl?
    ... if you were to later migrate to MS SQL Server or Oracle ... minimize your load on the database server's compiled procedure cache. ... On the other hand, if startup time for your perl script is an issue, and ... slightly preferable to the bulkier DBI + DBD::ODBC. ...
    (comp.lang.perl)
  • Re: executing MS SQL Server stored procedures
    ... > I am trying to run an MS SQL server stored procedure using Perl. ... Using the current Perl and DBI. ... > use the 'exec' command but get syntax errors on the execute for the ...
    (perl.dbi.users)
  • RE: [dbi] executing MS SQL Server stored procedures
    ... > I am trying to run an MS SQL server stored procedure using Perl. ... Using the current Perl and DBI. ... > I use the 'exec' command but get syntax errors on the execute for the ... Martin J. Evans ...
    (perl.dbi.users)
  • Perl crashes with DBD::ODBC to SQL server
    ... With the following code I can connect to the MS SQL server. ... use strict; ... use DBI; ... but whenever I try to run any kind of query, I get the "Perl Command ...
    (perl.dbi.users)
  • Re: use, require or none of the above?
    ... Definitely a lot of extra punctuation that would be more ... > difficult to read for me and an easy way for syntax errors to creep ... In fact the whole OO paradigm in Perl is a little nutty to me, ... I agree but I couldn't figure out how to resolve it. ...
    (perl.beginners)