This is a problem that I have encountered in my actual project. The results of 03bhl01001 (Shanghai) and 03bhl01001 (Shanghai) are the same. Causes the duplicate primary key problem that is caused.
The difference between 03bhl01001 (Shanghai) and 03bhl01001 (Shanghai) is that the former bracket is a full-width bracket character, and the latter is a half-width bracket character. The full-width parenthesis character and the Half-width bracket character of the ASCII code are obviously not the same. Full-width (ASCII code is 0XA3A8, and Half-width (is 0x28). So why does SQL Server think it's the same?
The problem is actually the collation of the database, so let's look at the SQL Server documentation. SQL Server collation consists of several parts, code pages, case-sensitive, accent-sensitive, and width-sensitive. The last one is not mentioned further in the SQL Server online Help, but the problem that this article encounters is caused by this reason. Width sensitive: Specifies that SQL Server distinguishes between single-byte representations (half-width) and Double-byte representations (full-width) for the same characters. If there is no selection, SQL Server will consider the same character as a single-byte representation and a double-byte notation.
By default, when you install the Chinese version of SQL Server, the sort rules that SQL Server chooses for you are chinese_prc_ci_as (CHINESE-PRC, case-insensitive, accent-sensitive, Kanatype-insensitive, Width-insensitive, is Chinese, case-insensitive, accent-insensitive, kana-insensitive, width-insensitive. Therefore, naturally agree with 03bhl01001 (Shanghai) =03bhl01001 (Shanghai).
Therefore, the correct choice should be that the suffix is the Chinese collation of WS. In this case we should choose Chinese_prc_ci_as_ws.
Let's take a look at what happens when you specify that the collation is chinese_prc_ci_as_ws.
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.