http://www.perlmonks.org?node_id=188199

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Someone PLEASE explain to me why the code below returns the error:
DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver][SQL +Server]Syntax error converting datetime from character string. (SQL-2 +2008)DBD:st_execute/SQLExecute err=-1) $dbh = DBI->connect('Database', '******', '*******', 'ODBC', {RaiseErr +or => 1}) or die "Database connection not made: $DBI::errstr"; $dbhstmt = $dbh->prepare("INSERT INTO ConfigTable ( strID, Modificatio +nDate) VALUES (?, ?)"); die "ERROR: Cannot prepare statement: $DBI::errstr\n" unless (defined +$dbhstmt); $dbhstmt->execute( '$SuStCo_strID', '$date' ); $dbhstmt->finish; $dbhstmt->finish; $dbh->disconnect;