SQL Server database is case sensitive

Source: Internet
Author: User

SOURCE http://blog.sina.com.cn/s/blog_457d6e63010108tv.html

Not tested.

SQL SERVER 2000/2005 is not case-sensitive by default, and can be collate chinese_prc_cs_as to require case sensitivity, and you can restore the default case-insensitive by collate chinese_prc_ci_as */

By default, SQL Server is case insensitive if the data table Test Tname column has the data "ABCD" and "ABCD" if the query statement is used: SELECT * from Test where tname like ' a% ', the result of the query will Two records are queried, which differs from Oracle.



You can set the collation to be case-sensitive, and you can specify collations when you create a database, modify the database, create a character column for a table (Char\varchar\nchar\nvarchar, and so on). Such as

Create DATABASE Test COLLATE chinese_prc_cs_as--This creates a case-sensitive

ALTER DATABASE Test COLLATE chinese_prc_cs_as--case sensitivity in modified databases

CREATE TABLE Test (tid int primary key,tname varchar COLLATE chines_prc_cs_as)-This creates Tname columns that are case-sensitive when using a SELECT statement.

SQL Server database is case sensitive

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.