Thanks much Martin.
I have installed ver1.23 and made changes suggested by you.

#!/usr/bin/perl use DBI; use Encode; my $AbsFileName = "E:\\Ajay\\sample\\sample\.pnx"; if (-e "$AbsFileName") { my ($DSN,$dbh,$sth); $dbh = DBI->connect("dbi:ODBC:DSN=<DSN>;UID=<USER>;PWD=<PASSWD +>") or die "$DBI::errstr\n"; $dbh->{odbc_utf8_on} = 1; my $sth = $dbh->prepare(<<SQL) or die "$DBI::errstr\n"; INSERT INTO BK_imageINfo (CustFld1,CustFld2,CustFld3,CustFld4, +CustFld5,CustFld6,CustFld7,CustFld8,CustFld9,CustFld10,CustFld11,Cust +Fld12,Efield1,Efield2,Efield3,Efield4,Efield5) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) SQL open INFILE, "<:encoding(UTF-8)", "$AbsFileName" or die "Can't + open File $AbsFileName for reading: $!\n"; while (my $data = <INFILE>) { chomp($data); my ($cfd1, $cfd2, $cfd3, $cfd4, $cfd5, $cfd6, $cfd7, $cfd8 +, $cfd9, $cfd10, $cfd11, $cfd12, $enr1, $enr2, $enr3, $enr4, $enr5) = + split /:/, $data; my $outfl = "E:\\Ajay\\sample\\query.txt"; open OUTFILE, ">>:encoding(UTF-8)", "$outfl" or die "Can't + open File $outfl for writing: $!\n"; my $sql = "INSERT INTO BK_imageINfo (CustFld1,CustFld2,Cus +tFld3,CustFld4,CustFld5,CustFld6,CustFld7,CustFld8,CustFld9,CustFld10 +,CustFld11,CustFld12,Efield1,Efield2,Efield3,Efield4,Efield5) VALUES +($cfd1, $cfd2, $cfd3, $cfd4, $cfd5, $cfd6, $cfd7, $cfd8, $cfd9, $cfd1 +0, $cfd11, $cfd12, $enr1, $enr2, $enr3, $enr4, $enr5)"; print OUTFILE "\n$sql\n"; close OUTFILE; $sth->execute($cfd1, $cfd2, $cfd3, $cfd4, $cfd5, $cfd6, $c +fd7, $cfd8, $cfd9, $cfd10, $cfd11, $cfd12, $enr1, $enr2, $enr3, $enr4 +, $enr5) or die "$DBI::errstr\n"; } close INFILE; #Close the database $sth->finish; $dbh->disconnect; } else { print "\n\n $AbsFileName doesn't exists\n"; }
Above code is working fine and i am able to insert Thai characters successfully. But i do have a DATETIME column in database. I am getting the error "DBD::ODBC::st execute failed: MicrosoftODBC SQL Server DriverInvalid character value for cast specification (SQL-22018)" when i insert value to date field.

Thanks,
Ajay

In reply to Re^4: Issue while inserting Thai Characters into Database.. by ajaykumarb
in thread Issue while inserting Thai Characters into Database.. by ajaykumarb

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.