When PHP connects to MSSQL, the nvarchar field length is truncated to 255. When PHP connects to MSSQL, the nvarchar field length is truncated to 255. mssqlnvarchar this article describes how to cut the nvarchar field length to 255 when PHP connects to MSSQL. Solution: The nvarchar field length is truncated to 255 when you connect MSSQL to PHP, mssqlnvarchar
This example describes how to remove the nvarchar field length from the MSSQL connection in PHP to 255. Share it with you for your reference. The specific analysis is as follows:
New users who use PHP to connect to MSSQL often encounter this problem: all the data in the nvarchar field in the database is normal, but it is found that the length of the nvarchar field is only 255, and we all know that, in MySQL, the varchar length is only 255, but MSSQL is not. PHP will not process nvarchar according to MySQL's varchar.
The solution is as follows:
The code is as follows:
Select cast (Target Field as text) from table name
If the summary field in your article table is nvarchar, run the following command:
The code is as follows:
Select cast (summary as text) from article
The code for cast is as follows:
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 help you with php programming.
Examples in this article describes how the nvarchar field length is truncated to 255 when PHP is connected to MSSQL. Share...