A like Chinese mismatch problem in SQL Server It's so easy to solve.

Source: Internet
Author: User
Tags uppercase letter

A like Chinese mismatch problem in SQL Server It's so easy to solve.
[2007-9-15 14:02:00 | By: No trace of dead water]

Ms-sql Server SELECT * from book where bookname like '% c language% ' can be found normally under SQL2000, under 2005 cannot, because the Chinese font in the statement, but using the select * from the book WH ere bookname like n '% c language% ', so that the completion of the normal, what is the meaning of the like after n? The Unicode character n converts the string to Nchar,nvarchar when the non-Unicode data sent by the client is stored in Unicode in the service , if one of the following conditions is true, data from any code page from any client can correctly store string constants beginning with the uppercase letter N. This is required regardless of whether the client application is capable of recognizing Unicode. If there is no letter N prefix, SQL Server converts the string to a code page that corresponds to the default collation of the database. Characters that are not in this code page will be lost.

In addition, for non-English string queries should also be written as Ike N ' ... '

 
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.