How can i change my insert statement so i will insert a date into the database? I've set the datatype in the database as dat/time with shortdate as the format.
sub Scan_File { my ($variables) = @_; my $dbh = DBI->connect('DBI:ODBC:mwalarm') or die "Couldn't connect to database: " . DBI->errstr; my $sql = "INSERT INTO Alarm_Info(EquipmentID, Chamber, LotID, Waf +er_Flow, Recipe, Wafer_Slot, Step_Value, AlarmType, Sensor, Signal_Level, Alarm_Upper_Limit, Alarm_Lowe +r_Limit, Code, Date_Submited, Time_Submited, FilesName, UserCode) VALUES ('$eqpid', '$chamber', '$lotid', '$wafer_flow', '$reci +pe', '$wafer_slot', '$step_value', '$alarmtype', '$sensor', '$signal_level', '$alarm_upper_limit', '$alarm_low +er_limit', '$code', '$date_submited', '$time_submited', '$filenames', '$usercode')"; #sendToLog ($sql) ; my $sth = $dbh->prepare($sql) or print ERROR "Couldn't prepare statement: " . $dbh->errstr; if ($alarmtype =~ /Clear/i) { unlink "$scan_dir\\$filename" or print ERROR "can't unlink Cle +ar $scan_dir\\$filename $!\n"; }else { $sth->execute() or die "cant execute" . $dbh->errstr; $sth->finish; } }

In reply to SQL Insert Statement for date by phimtau123

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.