[SQL Server] SQL Server collate settings (character set)

Source: Internet
Author: User
SQL Server collate settings (character set)

-- XP Chinese Environment
Use master
Go
If db_id ('test') is not null drop database Test
Go
Create Database test -- default database creation collate = chinese_prc_ci_as is case insensitive
Go
Use test
Go
Create Table test1 (id int)
Go
Select * From test1 -- this query is correct

-- Test Case sensitivity
Alter database test collate chinese_prc_cs_as -- case sensitive
Go
Select * From test1 -- the query result returns an error
Go
/*
Message 208, level 16, state 1, 1st rows
The object name 'test1' is invalid.
*/

-- Change back to default collate = chinese_prc_ci_as
Alter database test collate chinese_prc_ci_as -- case insensitive
Go
Select * From test1 -- this query is correct
Go

-- View the collate of the data

Sp_helpdb Test
-- The status contains collation = chinese_prc_cs_as.

 

 

Status = online, updateability = read_write, useraccess = multi_user, recovery = simple, version = 611, collation = offline, sqlsortorder = 0, isautoclose, isautocreatestatistics, isautoupdatestatistics, isfulltextenabled

 

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.