I'm using Perl, along with DBD::ODBC and MS SQL Server 2000, to create a
weblog system... anyways, i gotta everything working right and i'm importing
some old news records from another script's DB ( text file-based ) .. there
are 108 records in total... everything goes fine ( DB is created, all other
items are imported without problems ) until i hit one particular record.
#######################################
## Here is the DB structure i'm using: ##
#######################
CREATE TABLE coranto_csql (
Coranto_newsid varchar(255) not null,
Coranto_User ntext not null,
Coranto_Category ntext null,
Coranto_newstime bigint not null,
Coranto_Subject ntext,
Coranto_CustomField_url_link ntext,
Coranto_CustomField_newssnippit ntext,
Coranto_Text ntext,
PRIMARY KEY (Coranto_newsid,Coranto_newstime)
);
####################################################
# Here is the subroutine which inserts each record.
####################################################
$Subs{'CorantoSQL_InsertDB'} = <<'END_SUB';
sub CorantoSQL_InsertDB {
my $sthc = $corantosql_dbh->prepare("INSERT INTO coranto_csql
(Coranto_Subject,Coranto_User,Coranto_Text,Coranto_newsid,Coranto_newstime,Coranto_Category,Coranto_CustomField_newssnippit,Coranto_CustomField_url_link)
VALUES (?,?,?,?,?,?,?,?)");
$sthc->bind_param(1, $Subject);
$sthc->bind_param(2, $User);
$sthc->bind_param(3, $Text);
$sthc->bind_param(4, $newsid);
$sthc->bind_param(5, $newstime);
$sthc->bind_param(6, $Category);
$sthc->bind_param(7, $CustomField_newssnippit);
$sthc->bind_param(8, $CustomField_url_link);
$sthc->execute();
$sthc->finish();
}
END_SUB
#######################################################
# Here is the record i am trying to INSERT into the DB
#######################################################
Coranto_Subject: Don Frye, Ken Shamrock Autograph Tours
Coranto_User: garrett
Coranto_Text: <b>Official Press Release</b><br><br>As part of a nationwide
tour to promote their fight in Japan for the Pride Fighting Championships
(on pay per view) on February 24th, Ken Shamrock (former UFC champion and
WWF Superstar) and Don "The Predator" Frye (former UFC Champion) will be in
Dallas, Texas tomorrow!<br><br>Be there!<br><br>Pride FC videos and DVDs
will be on sale for fans and this is your chance to meet the legends and get
your videos signed!<br><br>Also, special local guests are expected at each
event, depending on the city. You never know which big NHB fighter may show
up!<br><br>Don't miss a rare chance to meet two of the best in the
sport!<br><br><ul><li>Ken Shamrock and Don Frye<br>Wednesday, February 6th
at 6:30pm<br>Fry's Electronics, Dallas, Texas</li><br><li>Ken Shamrock and
Don Frye<br>Thursday, February 7th at 6pm<br>Fry's Electronics, Phoenix,
Arizona</li><br><li>Ken Shamrock and Don Frye<br>Friday, February 8th at
7pm<br>Tower Video on Sunset, West Hollywood, California</li>
Coranto_newsid: EpEFkEuZVljCJkETqB
Coranto_newstime: 1012896000
Coranto_Category: (default)
Coranto_CustomField_newssnippit: As part of a nationwide tour to promote
their fight in Japan for the Pride Fighting Championships (on pay per view)
on February 24th, <a
href="http://www.sherdog.com/fightfinder/displayfighter.cfm?fighterid=4">Ken
Shamrock</a> (former UFC champion and WWF Superstar) and <a
href="http://www.sherdog.com/fightfinder/displayfighter.cfm?fighterid=124">Don
"The Predator" Frye</a> (former UFC Champion) will be in Dallas, Texas
tomorrow, February 6, 2002.
#######################################
# CONCLUSION
#######################################
Can anyone tell me why i might be getting a "String data, right truncation"
error when i try to insert this record into my DB??
I make sure the DB connection uses the following:
$dbh->{LongReadLen} = 5120000;
$dbh->{LongTruncOk} = 0;
# Automatically determine the binding type to be used for each column
$dbh->{odbc_default_bind_type} = 0; # before creating the query...
Thanks!
_________________________________________________________________
MSN Photos is the easiest way to share and print your photos:
http://photos.msn.com/support/worldwide.aspx