I am trying to insert into a table. And It is giving me an error. Can someone please tell me what am I doing wrong?
foreach my $sub (keys %data) { ($Artist, $Song) = split(/\|/, $sub); $DictIDNums = join(", ", @{$data{$sub}}); $CheckQuery = "Insert into MeterMusicTemp..QCStuff Select dictid,f +ilename,'$Song' from (select dictid,filename,artist,title,song,path,h +holdid,updated_by,filesize from FMDATAFILE3 where PPMonth=$PPMonth a +nd ($RuleID) and dictid in (select dictid from dictionary d,artist a, +song s where d.artistid=a.artistid and d.songid=s.songid and artist=' +$Artist' and song = '$Song') and matchlevel<3) as T1 where lower(File +Name) not like lower('%$Song%') order by filename "; print "$CheckQuery\n"; my $dbh = DBI->connect( "DBI:ODBC:MusicWatch", "App_User", "au", { + RaiseError => 1, AutoCommit => 0 }); eval { $dbh->do("$CheckQuery"); $dbh->commit( ); }; if ($@) { eval { $dbh->rollback( ) }; die "Couldn't roll back transaction" if $@; }
Thanks, PJOfNJ

In reply to Insert into DB problem by pjofnj

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.