Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??
Greetings Monks,
 I have installed DBD::ODBC and have setup FreeTDS driver, via unixodbc, to connect to a MS SQL server. Here is my simple test code to execute a stored procedure:
use DBI; my $DSN = 'driver=FreeTDS;Server=mssql_server; database=test;uid=user; +pwd=password;'; my $dbh = DBI->connect("dbi:ODBC:$DSN") or die "$DBI::errstr\n"; my $sth = $dbh->prepare('EXEC sp_who'); $sth->execute();
While executing this code, I get the error:
 DBD::ODBC::st execute failed: (DBD: st_execute/SQLExecute err=-1)
I have searched the monastory and found a few questions, such as MS SQL Stored Procedure Syntax, however there didn't seem to be any conclusive answers.

How do I execute stored procedure against a MS SQl server, using DBD::ODBC ? Although Im not able to execute a stored procedure, other SQL queries work. Thanks.

In reply to DBD::ODBC, FreeTDS and Stored Procedure by InfiniteLoop

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.