Solution to the problem that the nvarchar field length is truncated to 255 when PHP connects to MSSQL, mssqlnvarchar_PHP tutorial

WBOY
Release: 2016-07-13 10:10:52
Original
911 people have browsed it

The solution to the problem that the nvarchar field length is truncated to 255 when PHP connects to MSSQL, mssqlnvarchar

The example in this article describes the solution to the problem that the nvarchar field length is truncated to 255 when PHP connects to MSSQL. Share it with everyone for your reference. The specific analysis is as follows:

Newbies who connect PHP to MSSQL often encounter this problem: the data in the nvarchar field in the database is normal, but when queried using PHP, the length is only 255. We all know that the length of varchar in MySQL is only 255, but in MSSQL But no, it’s not because PHP processes nvarchar according to MySQL’s varchar.

This article gives the solution:

Copy code The code is as follows:
select cast (target field as text) from table name

If there is a field summary in your article table that is nvarchar, then the command is:

Copy code The code is as follows:
select cast(summary as text) from article

About cast, the code is as follows:

Copy code The code is as follows:
CAST ( expression AS data_type )

expression is the target field

data_type is the data type to be converted

I hope this article will be helpful to everyone’s PHP programming design.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/932480.htmlTechArticleThe solution to the problem that the nvarchar field length is truncated to 255 when PHP connects to MSSQL, mssqlnvarchar This article describes the example when PHP connects to MSSQL Solution to nvarchar field length being truncated to 255. Share to...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!