Some error messages would be nice, but one thing that springs to mind is that you don't declare any of your miriad of variables. strict will rightly yell at you for that. You also have lots of incorrectly closed quotes. It isn't very wise to post unobscured passwords on public forums either.

The following is an untested cleanup. Please do ask about anything you don't understand.

#!/usr/bin/perl -w use strict; use DBI; my @fields = qw( CLIENT RECORD CONTROL CUSIP FROMACCT F_IND TOACCT T_IND FP ORIGQTY DIV LTCG STCG SOCSEC BKRNO THIRDPARTYCD USERID EDATE ORIGAMT CLOSEDIND ADPSECNO BRNCH ACNT TYPE CHKDIGIT PDATE ACTLQTY ACTLAMT CERTIND REQST RDATE COMNTS TRNFTYPE FILLER1 ADR_L1 ADR_L2 ADR_L3 ADR_L4 ADR_L5 ADR_L6 FILLER_B CERTNO1 CERTSHRS1 CERTNO2 CERTSHRS2 CERTNO3 CERTSHRS3 CERTNO4 CERTSHRS4 CERTNO5 CERTSHRS5 CERTNO6 CERTSHRS6 CERTNO7 CERTSHRS7 CERTNO8 CERTSHRS8 CERTNO9 CERTSHRS9 CERTNO10 CERTSHRS10 FILLER_B ); my $dbh = DBI->connect( "dbi:ODBC:INSTDev", "sa", "password", { RaiseError => 1, PrintError => 1, AutoCommit => 1 } ) or die "Unable to connect: $DBI::errstr\n"; @ARGV = ("/tf_out.txt"); my $sth = do { my $cols = join(',', @fields); my $placeholders = join(',', ('?') x @fields); $dbh->prepare("INSERT INTO mf_forms ($cols) VALUE ($placeholders)" +; }; while(<>) { chomp; my %infields; @infields{+FIELDS} = split /\t/, $_, -1; $sth->execute(@infields{+FIELDS}); } $dbh->disconnect;

Makeshifts last the longest.


In reply to Re: Problem with code by Aristotle
in thread Problem with code by SamueD2

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.