#!/usr/bin/perl
use DBI;
use Data::Dumper;
use strict;
my $DSN = q/dbi:ODBC:SQLSERVER/;
my $uid = q/username/;
my $pwd = q/password/;
my $first_param=723454;
my $current_date="2012-10-25 00:30:21";
my $after_2min="2012-10-25 05:47:41";
my $dbh = DBI->connect($DSN,$uid,$pwd) or die "Coudn't Connect SQL";
my $sql2 = "insert reverise_call_main_menu call_number,call_originate_time,call_inbetween_time,call_after_2min_time) values(?,?,?,?)";
my $sth2 = $dbh->prepare($sql2);
$sth2->execute($first_param,$current_date,'null',$after_2min);
$sth2->finish;
$dbh->disconnect;
whenever i execute a program i got following error:
output:-
DBD::ODBC::st execute failed: [unixODBC][FreeTDS][SQL Server]Conversion failed when converting datetime from character string. (SQL-22007)
The error message indicates that SQL Server does not like the format of your datetime strings. You may wish to use DateTime::Format::DBI to help get the formatting right.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.