Perl dbi data access odbc reading SQL server data is truncated

Source: Internet
Author: User
Select returns the error DBD: ODBC: stfetchrow_arrayreffailed: st_fetchSQLFetch (SQL-HY000) with $ dbh_mssql-{LongTruncOk} 1; which can be addressed. However, this method truncates characters.

Select returns the error DBD: ODBC: st fetchrow_arrayref failed: st_fetch/SQLFetch (long truncated DBI attribute LongTruncOk not set and/or LongReadLentoo small) (SQL-HY000) in this case, $ dbh_mssql-{LongTruncOk} = 1; can be used. However, this method truncates characters.

Select Error
DBD: ODBC: st fetchrow_arrayref failed: st_fetch/SQLFetch (long truncated DBI attribute LongTruncOk not set and/or LongReadLen too small) (SQL-HY000)

In this case
$ Dbh_mssql-> {LongTruncOk} = 1;
Yes.
However, this method will TruncationString.
I don't want TruncationString to be complete Read. After reading the documents, we can set the length of Long.
Use:
$ Dbh_mssql-> {LongReadLen} = 512*1024;
It is invalid when used separately.
The same error is reported.
$ Dbh_mssql-> {LongReadLen} = 512*1024;
$ Dbh_mssql-> {LongTruncOk} = 0;
Error

But it is not used together with $ dbh_mssql-> {LongTruncOk} = 1; ProblemBut still yes Truncation.

Or is the len Length not enough here? 2048*2048 still does not work


Result andDataType.


$ SQL _select = "select top 5 [name], [address], [developer], CAST ([othercondition] as TEXT), [projectsquare], [usinglandarea] from new_baseinfo ";


Pay attention to the red part.

It also involvesDataTypeProblem. BindTruncationTo text.
Then set.
My $ dbh_mssql = DBI-> connect ("dbi: ODBC: $ source_name", $ source_user_name, $ source_user_psd );

$ Dbh_mssql-> {LongTruncOk} = 1;
$ Dbh_mssql-> {LongReadLen} = 1048576*1024;
Print "LongReadLen: $ dbh_mssql-> {LongReadLen} \ n ";

You can.



References:

Http://blog.csdn.net/aylazhang/article/details/1707745

Http://www.freetds.org/userguide/troubleshooting.htm

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.