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 nation +wide tour to promote their fight in Japan for the Pride Fighting Cham +pionships (on pay per view) on February 24th, Ken Shamrock (former UF +C 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 c +hance to meet the legends and get your videos signed!<br><br>Also, sp +ecial 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>Ke +n 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 promo +te their fight in Japan for the Pride Fighting Championships (on pay +per view) on February 24th, <a href="http://www.sherdog.com/fightfind +er/displayfighter.cfm?fighterid=4">Ken Shamrock</a> (former UFC champ +ion and WWF Superstar) and <a href="http://www.sherdog.com/fightfinde +r/displayfighter.cfm?fighterid=124">Don "The Predator" Frye</a> (form +er 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:

$corantosql_dbh->{LongReadLen} = 5120000; $corantosql_dbh->{LongTruncOk} = 0;
# Automatically determine the binding type to be used for each column
$corantosql_dbh->{odbc_default_bind_type} = 0; # before creating the q +uery...
Thanks!

formatting fix by chromatic on Sat Mar 30 17:16:53 UTC 2002


In reply to String data, right truncation error with DBD::ODBC and MS SQL Server 2000 by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.