PHP uses sqlsrv to query a field named Chinese in a remote sql2008 data table without a value

Source: Internet
Author: User
PHP uses sqlsrv to query a field in a remote sql2008 data table that has a field named Chinese that does not take a value. As shown below:

Query statement:
Select top 1 customid, requirement ID, requirement type, requirement description, resolution time limit, demand submission time, flag, lastmodify from D_ request Submit ORDER by Customid

The results obtained:
Customer number: 500364, request Number: Demand Type: Demand Description: Resolution Time: Demand Submission time: Mark: Last modified: 1014
As shown above: Only Customid and lastmodify take the value

encoding specified when connecting to the library: Characterset=>utf-8

Urgent, online etc!


Reply to discussion (solution)

Escape, yes!
Select top 1 customid,[requirements id],[Requirements Type],[requirements Description],[Resolution Time],[Demand submission time],[flag],lastmodify from [d_ demand submission] ORDER by Customid

You create a query in the controller and you know how to write it.

Escape, yes!
Select top 1 customid,[requirements id],[Requirements Type],[requirements Description],[Resolution Time],[Demand submission time],[flag],lastmodify from [d_ demand submission] ORDER by Customid

You create a query in the controller and you know how to write it.
What do you mean by escaping? Like you above this writing in the sql2008 is normal, but PHP is the same as the Chinese text field does not get the value ah, escaped is?

[] Bracket is the name of SQL Server escape character, and MySQL's "the same role

SQL Server field name does not support UTF-8 encoding
Two-byte encoding (Unicode) operating system is the invention of Microsoft, Utf-8 is only designed to be compatible with UTF standards

You have a weird problem, you can try to convert the query string to GBK or ucs-2 encoded look

Conversion, the problem still has

Do It yourself! Making a field name in Chinese is a mistake in itself

Not at hand. SQL Server failed to test

Problem solved, Chinese text segment real Pit

  • Related Article

    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.