Month End Offer : Get 30% OFF + $999 Study Material FREE - SCHEDULE CALL

sddsfsf

SQL Server Collation-All You Need to Know

 

What is SQL Server Collation?

Collations in SQL Server lay out’s sorting rules, case, and accent sensitivity properties to data. A collation defines bit patterns representing each character in the database's metadata. SQL Server helps in storing objects that have various collations in the database. The options associated with collation are mentioned below

  • Case-sensitive (_CS)
  • Accent-sensitive (_AS)
  • Kana-sensitive (_KS)
  • Width-sensitive (_WS)
  • Variation-selector-sensitive (_VSS)a
  • Binary (_BIN)
  • Binary-code point (_BIN2)

What is a Database Collation SQL server?

A database collection is a predefined set of rules that control how SQL Server stores, retrieves, and compares data. Although there are multiple rules or collations in SQL Server, we should be familiar with the following two primary collations.

  1. SQL_Latin1_General_CP1_CI_AS
  2. SQL_Latin1_General_CP1_CS_AS

Here the CI is case-insensitive, and CS is case-sensitive.That is why the collation in SQL Server is case-insensitive by default, meaning it is not bothered with any particular case. All of the databases that compile SQL Server are case-insensitive as well.In the project, we must match the data and include a log in the form here. We will retrieve the data and verify that only the spelling is correct if the data are in the same cases. SQL Server will check no cases.Therefore, we must manually utilize the collate in sql server in our database or column of a table to resolve this issue.

An illustration of the two types of collations will be provided here.

Create database mydb
Collate SQL_Latin1_General_CP1_CS_AS

The output looks like the one below.

We have created a database, my-db, with case-sensitive collations with the following table and records.

use mydb
go
create table student (id nvarchar(10),Name nvarchar(20))
Insert into student values ('A123', 'Debendra')
Insert into student values ('A124',' Sujata)
Insert into student values ('A125', 'ram')
insert into student values ('A126',' Manoj)

The  table student will look like this:

Now we are trying this query to fetch the records.

select * from student where id='a123'

Here the database collation is case insensitive, and the query id is not in the proper case as per the record, so this is the final output we received.

If we create another database with case-insensitive collation, create the same student table and add the duplicate records.

create database Mydb1
Collate SQL_Latin1_General_CP1_CI_AS
use Mydb1
go
create table student (id nvarchar(10),Name nvarchar(20))
insert into student values ('A123', 'Debendra')
insert into student values ('A124',' Sujata)
insert into student values ('A125', 'ram')
insert into student values ('A126', 'Manoj')
Select * from the student.
select * from student where id='a123'

Now we are selecting a record with a case-insensitive id, but this will work because our database, "My db1," is created with case-insensitive collation.

So the result will be:

In this method, we can substitute the collation of a database and work depending on needs and requirements. Likewise, we can switch our Column collation id if needed.To check the collation, you must expand the database, right-click on a table, go to the property menu, and check the extended property.

Since we created the CS collation, the collation here shows CS. But by default, the collation is CI.If we want to check the collation of a column of a table, then we can check it while creating the column like this:

It is the default based on the database.

What are Different SQL Collation Options?

Below is a quick overview of different SQL collation Options:

What is Collate in MYSQL?

A collation in MySQL is a set of rules used to differentiate the characters in a particular character set. It is a sequence of orders to any particular set. MySQL assists various character sets; each set always uses one or more collations, at least one default collation.

Get in-depth knowledge on SQL servers and more via online tutorials for sql. It is going to open a new window for learning. 

How to Add Collate in MySQL

MySQL utilizes latin1 as the default character set. Therefore, the default collation is latin1_swedish_ci. If you specify one character set at server startup, MySQL will utilize the default collation of that character set.

Use of Collation in SQL Server

An everyday use of query-level collation (sql server collate) is to compare case-sensitive strings. For example, imagine two tables with similar collations and compare their columns using join or subquery. Data with the lower-case string exists in the chosen columns of those tables.

cta14 icon

SQL Testing Training

  • Personalized Free Consultation
  • Access to Our Learning Management System
  • Access to Our Course Curriculum
  • Be a Part of Our Free Demo Class

Conclusion

This blog discusses the definition, use of collate, and types of SQL Server Collation. The importance of sql collation is that it makes it fast and easy for a user to find an element in the list or confirm that it is absent. It also gives an overview of MySQL. The blog will be a valuable read for database administrators and anyone interested in learning about collation in general. If you know to be an expert in this area, opt for an online sql server training course.

Trending Courses

Gen AI icon

Gen AI

Gen AI icon1

Upcoming Class

7 days 30 Jun 2026

Agentic AI icon

Agentic AI

Agentic AI icon1

Upcoming Class

3 days 26 Jun 2026

AI in Automation Testing icon

AI in Automation Testing

AI in Automation Testing icon1

Upcoming Class

10 days 03 Jul 2026

Cyber Security icon

Cyber Security

  • Introduction to cybersecurity
  • Cryptography and Secure Communication 
  • Cloud Computing Architectural Framework
  • Security Architectures and Models
Cyber Security icon1

Upcoming Class

-1 day 22 Jun 2026

Data Science icon

Data Science

  • Data Science Introduction
  • Hadoop and Spark Overview
  • Python & Intro to R Programming
  • Machine Learning
Data Science icon1

Upcoming Class

11 days 04 Jul 2026

QA icon

QA

  • Introduction and Software Testing
  • Software Test Life Cycle
  • Automation Testing and API Testing
  • Selenium framework development using Testing
QA icon1

Upcoming Class

0 day 23 Jun 2026

Salesforce Service Cloud icon

Salesforce Service Cloud

  • Industry Knowledge Introduction
  • Adoption and Maintenance
  • Interaction Channels Introduction
  • Integration and Data Management
Salesforce Service Cloud icon1

Upcoming Class

10 days 03 Jul 2026

AWS icon

AWS

  • AWS & Fundamentals of Linux
  • Amazon Simple Storage Service
  • Elastic Compute Cloud
  • Databases Overview & Amazon Route 53
AWS icon1

Upcoming Class

-1 day 22 Jun 2026