sub updateFlyer { my $contentType = shift; use DBI qw(:sql_types); my ( $sql, $sth, $dbh, $mimeType, $contentImage ); # Database connection $dbh = DBI->connect("dbi:ODBC:something", 'something', 'somepass', {RaiseError => 1}) or die DBI->errstr; # Debug stuff if (1) { DBI->trace(2, "trace.txt"); } ( $mimeType, $contentImage ) = uploadImage( $query ); $sql = "UPDATE interface..CustomContent " . "SET contentImage = ?," . " contentImageType = ? ". "WHERE contentType = ?"; $sth = $dbh->prepare( $sql ); # Gotta bind the image $sth->bind_param( 1, $contentImage, SQL_LONGVARBINARY ); $sth->execute ( $contentImage, $mimeType, $contentType ); $sth->finish; $dbh->disconnect; } #### DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server Driver][SQL Server]String or binary data would be truncated. (SQL-22001) [Microsoft][ODBC SQL Server Driver][SQL Server]The statement has been terminated. (SQL-01000)(DBD: st_execute/SQLExecute err=-1) at D:\somepath\cgi-bin\somescript.cgi line 447. #### Failed upload: (size 12723/12724/0, ptype 4, otype 1) Good upload: (size 12723/12724/12723, ptype 4, otype 1)