I have a script on one of my older systems that parses bandwidth usage from a flat text file and then inserts this data into a MS SQL 2000 database. This legacy system runs DBD::ODBC v0.28.

The goal is to replace this legacy system with a newer machine running Perl v5.6.1 and DBD::ODBC v1.40. Unfortunately the script won't play nice and fails on the new system.

Here the error message I get when executing the script:

DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver]Invalid character value for cast specification (SQL-22005)(DBD: st_execute/SQLExecute err=-1) at ....

Here the code it's puking on:

my ($serverid, $mbin, $mbout) = @_;
my ($query, $rc, $sth);

$query = "INSERT INTO BandwidthUsage";
$query .= " (TS, ServerID, MBin, MBout)";
$query .= " values (?,?,?,?)";
# $starttime == date in mm/dd/yyyy format
$sth = $dbh2->prepare($query);
$sth->execute($starttime, sprintf("%d",$serverid),sprintf("%.1f",$mbin),spri ntf("%.1f",$mbout));

Any ideas what could be causing my troubles?