I would try it with literal values from the insert that you say works manually.

$SQL = "INSERT INTO iCDRSbw (rec_num,src_file,src_host,init_status,cdr +_day,last_modified,city,state,cname,vname, npa,nxx,ocn,lata,lata_name,pdd,zone_id,cdrs_seq,file_seq,g +c_id ) VALUES (?,?,?,?,?,?,?,?,?,?, ?,?,?,?,?,?,?,?,?,?)"; my $database_username = "USER"; my $database_password = "PASS"; my $msdsn = q/dbi:ODBC:DRIVER={SQL Server};Server=10.0.0.5;attr=value/ +; my $dbh = DBI->connect( $msdsn, $database_username, $database_password + ) or die "ERROR"; $dbh->do("use db_name") or log_die("$DBI::errstr"); my $sth = $dbh->prepare( $SQL ); $sth->execute( 1, 'icdr.5_5_5B.0.1.200712170000.052964.0', '127.0.0.1' +, 'Unprocessed', '2007-12-17 00:00:47', '2007-12-17 00:00:47','NA','NA',' ',' ', 999,999,' ',1,1,1,1,1,1,'AAAAC0dlvAgiIAABC7Przw.7591990 +' ) or print "DBI error: " . $sth->errstr;

You might also try using DBI->trace() to see more of what's going on (see the DBI docs).


In reply to Re^3: What is wrong with this mSQL insert? by kyle
in thread What is wrong with this mSQL insert? by hallikpapa

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.