Home >Backend Development >PHP Tutorial >When PHP connects to MSSQL, the nvarchar field length is truncated to 255_PHP tutorial
Novices 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:
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:
The code is as follows
|
Copy code
|
||||||
select cast(summary as text) from article
About cast:
|
|||||||
CAST ( expression AS data_type ) http://www.bkjia.com/PHPjc/632940.html www.bkjia.com truehttp: //www.bkjia.com/PHPjc/632940.htmlTechArticlePHP Newbies who connect to MSSQL often encounter this problem: the data in the nvarchar field in the database is all normal, but when using PHP After checking, we found that the length is only 255. We all know...
|