I have a bit of code that inserts data into an SQL 7 DB via perl & DBI.
However some times when lots of data gets put into one of the fields i get the following error
[Microsoft][ODBC SQL Server Driver]String data, right truncation (SQL-22001)(DBD: st_execute/SQLExecute err=-1)
This i believe is down to too much data being passed over to the table.
However i am having a little bit of difficulty believing that as the colum type of the column in question is text 16.
I am of the understanding that, that is pretty huge. I am trying to put into that colum 12700 chars.
here is my connection data
$DSN = "driver={SQL Server};Server=$server;database=$database;uid=$username;pwd=$password;";
$data_source = "$source:$DSN";
$db_user = undef;
$db_pwd = undef;
$dbh = DBI->connect($data_source, $db_user, $db_pwd, { RaiseError => 0, AutoCommit => 1 })
|| reportError("CMF", "ERROR", "2", "Database connection error : " . $DBI::errstr . " DBServer = '$server' Database = '$database' User = '$username'");
# Need to make the default length of the returned field larger. default is 80 chars.
$dbh->{LongReadLen} = 1000000;
# Truncate everything over 1000000 ($dbh->{LongReadLen}) or it will error out.
$dbh->{LongTruncOk} = 1;
and here is the bit of code that inserts into the DB
$Stmt = "execute usp_update_ipr_by_job_id_nr ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?;";
$sth = $dbh->prepare_cached($Stmt) || return;
$sth->bind_param(1, $JobId);
$sth->bind_param(2, $JobCreator);
$sth->bind_param(3, $IprName);
$sth->bind_param(4, $IprDescription);
$sth->bind_param(5, $IprRationale);
$sth->bind_param(6, $IprImplications);
$sth->bind_param(7, $IprSource);
$sth->bind_param(8, $TargetLiveDate);
$sth->bind_param(9, undef);
$sth->bind_param(10, undef);
$sth->bind_param(11, $Dependencies);
$rv = $sth->execute();
if ($DBI::err)
{
reportError("CMF", "ERROR", "7", "Update IPR Problem : DBServer = '$server'
Database = '$database' User = '$username' DB_Error_Msg = '" . $DBI::errstr . "'");
}
return ();
does anyone know if there is a physical length to the size of the actual sql query?
does anyone know if my interpretation of the error message is correct?
Has anyone had this before and got round it?
Cheers
HazzieTS 5.5.2 on NT.
Edited by Hazzie on 07/10/03 08:04 AM (server time).