PHP connection MSSQL when the nvarchar field length is truncated to 255 of the workaround, mssqlnvarchar_php tutorial

Source: Internet
Author: User
Tags truncated

PHP connection MSSQL when the nvarchar field length is truncated to 255 of the workaround, Mssqlnvarchar


This article describes a workaround for nvarchar field length truncated to 255 when PHP connects to MSSQL. Share to everyone for your reference. The specific analysis is as follows:

PHP Connection MSSQL Novice Often encounter this problem: Database inside the nvarchar field data all normal, but with PHP query out but found only 255 length, we all know, in MySQL, the length of the varchar is only 255, but MSSQL is not , PHP will not be nvarchar according to the MySQL varchar processing it.

This article gives a workaround:
Copy the code as follows: Select CAST (Target field as text) from table name

If your article table has a field summary as nvarchar, then the command is:
Copy the Code code as follows: Select CAST (summary as text) from article

For cast, the code is as follows:
Copy the Code code as follows: CAST (expression as data_type)

Expression is the Target Field

Data_type is the type of data to convert to

I hope this article is helpful to everyone's PHP programming.

http://www.bkjia.com/PHPjc/932480.html www.bkjia.com true http://www.bkjia.com/PHPjc/932480.html techarticle PHP connection MSSQL nvarchar field length is truncated to 255 of the solution, Mssqlnvarchar This example describes the PHP connection MSSQL nvarchar field length is truncated to 255 resolution method. Share to ...

  • 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.