SQL ignore-case | How to Check the case-sensitivity of SQL server? (2024)

Updated March 8, 2023

SQL ignore-case | How to Check the case-sensitivity of SQL server? (1)

Introduction to SQL ignore-case

SQL Case sensitivity is to use the query statements and the keywords tables and columns by specifying them in capital or small letters of alphabets. SQL keywords are by default set to case insensitive, which means that the keywords are allowed to be used in lower or upper case. The names of the tables and columns specification are set to case insensitive on the SQL database server; however, it can be enabled and disabled by configuring the settings in SQL. The COLLATION is the property that decides and helps us to specify whether the elements other than keywords in SQL are to be allowed for case insensitivity or not. In this article, we will learn how we can check for the assigned collation values that determine case sensitivity of SQL and further see how lower and upper functions are used to make the queries that ignore the case of the values of the columns while searching or applying restriction. In this topic, we are going to learn about SQL ignore-case.

ADVERTIsem*nT Popular Course in this categorySQL - Specialization | 51 Course Series | 6 Mock Tests

Start Your Free Data Science Course

Hadoop, Data Science, Statistics & others

Checking the case sensitivity of SQL server

We can write the keywords SELECT, FROM, WHERE, GROUP BY, etc., in either upper or lower case as they are case insensitive in SQL. The objects other than the keywords, like names of columns, tables, views, triggers, stored procedures, etc., can either be case sensitive or case insensitive. By default, they are set to case insensitive. The COLLATION property of the SQL server can be checked by using the function named Sevrverproperty() of SQL and passing the COLLARION as the parameter to it to get the value that is set as the collation to that SQL server. After executing it, you will get the collation value as shown in the output of the following query statement most of the times –

SELECT Serverproperty('COLLATION') AS COLLATION;

The output of the execution of the above query statement is as follows –

SQL ignore-case | How to Check the case-sensitivity of SQL server? (2)

SQL ignore-case | How to Check the case-sensitivity of SQL server? (3)

The collation value contains either CI or CS in it. They stand for case insensitive and case sensitive, respectively. In the above output, we can observe that the collation value contains CI that is case sensitive, and hence while querying on that database server, the objects other than keywords can be specified in upper or lower case. The same applies to keywords as they are allowed to be entered in any case, but most of the time, it is a good practice to use them in all upper cases according to conventions.

Alternatively, the collation property for SQL database server can also be checked by querying on the table named databases that are present in the sys database of your SQL server to check for the case sensitivity that is allowed for the particular database by mentioning the value of the name column as the value of your database name for which you are checking the collation. Let us a query for the existing database at my SQL server named educba and check for the collation value using the contents of the databases named table of sys database and following query statement –

SELECT collation_name AS COLLATIONFROM sys.databasesWHERE name = 'educba';

The output of the execution of the above query statement is a follows, giving the collation value as SQL_Latin1_General_CP1_CI_AS in which CI stands for case insensitivity which allows us to query on that database by specifying non-keyword words in upper or lower case –

SQL ignore-case | How to Check the case-sensitivity of SQL server? (4)

SQL ignore-case | How to Check the case-sensitivity of SQL server? (5)

Using LOWER() and UPPER() functions for case in-sensitive that is ignoring the case in queries.

Suppose that the table named educba_articles that exists in my educba database has the collation set to case sensitive collation as shown in the below image –

SQL ignore-case | How to Check the case-sensitivity of SQL server? (6)

Let us check the contents of the table by executing the following query statement on the table –

SELECT * FROM educba_articles;

The output of the execution of the above query statement is as follows –

SQL ignore-case | How to Check the case-sensitivity of SQL server? (7)

Now, executing the following query using lower function helps in retrieving all the submitted records –

SELECT * FROM educba_articles WHERE LOWER(status) = "submitted";

The output of the execution of the above query statement is as follows –

SQL ignore-case | How to Check the case-sensitivity of SQL server? (8)

Now, we will use the function to make an insensitive comparison that makes the comparison using the UPPER function as shown in the below query statement –

SELECT * FROM educba_articles WHERE UPPER(status) = "SUBMITTED";

The output of the execution of the above query statement is as follows –

SQL ignore-case | How to Check the case-sensitivity of SQL server? (9)

In a similar fashion, UPPER() and LOWER() functions can be used in the LIKE clause for getting similar records and making the search ignoring the case in the table or database having collation that shows CS that is case sensitive in its collation. Consider that we have to find out all the records of the table educba_articles table “ing” value in its name column. We can use the LIKE clause for searching the contents containing the “ing” value in the name, and further to search such that the case is ignored, we will use the LOWER() function first. Our query statement is as follows –

SELECT * FROM educba_articles WHERE LOWER(` name`) LIKE "%ing%";

The output of the execution of the above query statement is as follows –

SQL ignore-case | How to Check the case-sensitivity of SQL server? (10)

Now, let us use the upper() function to use the search facility that makes the ignore-case search. For this, our query statement will be as follows –

SELECT * FROM educba_articles WHERE UPPER(` name`) LIKE "%ING%";

The output of the execution of the above query statement is as follows –

SQL ignore-case | How to Check the case-sensitivity of SQL server? (11)

Conclusion – SQL ignore-case

The SQL case sensitivity can be set for non-keyword objects such as tables and columns by specifying the collation against the database, tables, and column level by mentioning CI or CS in it that stands for case insensitive and case sensitive, respectively. If the collation is set to CI containing the value that is Case insensitive, then there is no necessity to use any function like LOWER() or UPPER() to make the search to ignore the case. Further, we can make the search and condition specifying to ignore the case in SQL using the LOWER() and UPPER() functions while collation contains CS. This can be used while applying restrictions with equal to the operator or search with LIKE keyword to make search case insensitive, that is, the search or restriction that ignores the case.

Recommended Articles

We hope that this EDUCBA information on “SQL ignore-case” was beneficial to you. You can view EDUCBA’s recommended articles for more information.

  1. SQL Cluster
  2. PostgreSQL Text Search
  3. MySQL Cross Join
  4. SQL DROP TRIGGER

ADVERTIsem*nT

MICROSOFT POWER BI - Specialization | 8 Course Series 34+ Hours of HD Videos 8 Courses Verifiable Certificate of Completion Lifetime Access4.5

ADVERTIsem*nT

ADVERTIsem*nT

MICROSOFT AZURE - Specialization | 15 Course Series | 12 Mock Tests 73 of HD Videos 15 Courses Verifiable Certificate of Completion Lifetime Access4.5

ADVERTIsem*nT

KALI LINUX - Specialization | 6 Course Series 20+ Hours of HD Videos 6 Courses Verifiable Certificate of Completion Lifetime Access4.5
Primary Sidebar

");jQuery('.cal-tbl table').unwrap("

");jQuery("#mobilenav").parent("p").css("margin","0");jQuery("#mobilenav .fa-bars").click(function() {jQuery('.navbar-tog-open-close').toggleClass("leftshift",7000);jQuery("#fix-bar").addClass("showfix-bar");/*jQuery(".content-sidebar-wrap").toggleClass("content-sidebar-wrap-bg");jQuery(".inline-pp-banner").toggleClass("inline-pp-banner-bg");jQuery(".entry-content img").toggleClass("img-op");*/jQuery("#fix-bar").toggle();jQuery(this).toggleClass('fa fa-close fa fa-bars');});jQuery("#mobilenav .fa-close").click(function() {jQuery('.navbar-tog-open-close').toggleClass("leftshift",7000);jQuery("#fix-bar").removeClass("showfix-bar");jQuery("#fix-bar").toggle();jQuery(this).toggleClass('fa fa-bars fa fa-close');/*jQuery(".content-sidebar-wrap").toggleClass("content-sidebar-wrap-bg");jQuery(".inline-pp-banner").toggleClass("inline-pp-banner-bg");jQuery(".entry-content img").toggleClass("img-op");*/});});

SQL ignore-case | How to Check the case-sensitivity of SQL server? (2024)
Top Articles
Endowment Insurance vs. Fixed Deposits: Which Is Better for You? - ValueChampion Singapore
37 Underrated Real Estate Lead Generation Ideas for 2022
Knoxville Tennessee White Pages
Fan Van Ari Alectra
Dricxzyoki
Mountain Dew Bennington Pontoon
Rek Funerals
Comcast Xfinity Outage in Kipton, Ohio
Tribune Seymour
Devourer Of Gods Resprite
Does Publix Have Sephora Gift Cards
Mercy MyPay (Online Pay Stubs) / mercy-mypay-online-pay-stubs.pdf / PDF4PRO
Ktbs Payroll Login
Tripadvisor Near Me
Wnem Radar
Blog:Vyond-styled rants -- List of nicknames (blog edition) (TouhouWonder version)
Cnnfn.com Markets
Money blog: Domino's withdraws popular dips; 'we got our dream £30k kitchen for £1,000'
Price Of Gas At Sam's
Bend Pets Craigslist
SF bay area cars & trucks "chevrolet 50" - craigslist
Foxy Brown 2025
Pickswise Review 2024: Is Pickswise a Trusted Tipster?
College Basketball Picks: NCAAB Picks Against The Spread | Pickswise
Bjerrum difference plots - Big Chemical Encyclopedia
Filthy Rich Boys (Rich Boys Of Burberry Prep #1) - C.M. Stunich [PDF] | Online Book Share
Foolproof Module 6 Test Answers
208000 Yen To Usd
Ardie From Something Was Wrong Podcast
Ullu Coupon Code
Ryujinx Firmware 15
Smayperu
Metro By T Mobile Sign In
Pokemmo Level Caps
Slv Fed Routing Number
Iban's staff
Montrose Colorado Sheriff's Department
Cherry Spa Madison
Convenient Care Palmer Ma
Author's Purpose And Viewpoint In The Dark Game Part 3
Locate phone number
Isabella Duan Ahn Stanford
Gotrax Scooter Error Code E2
Foxxequeen
Dr Mayy Deadrick Paradise Valley
Best Conjuration Spell In Skyrim
Ups Authorized Shipping Provider Price Photos
22 Golden Rules for Fitness Beginners – Barnes Corner Fitness
Southwest Airlines Departures Atlanta
What is 'Breaking Bad' star Aaron Paul's Net Worth?
Mega Millions Lottery - Winning Numbers & Results
Palmyra Authentic Mediterranean Cuisine مطعم أبو سمرة
Latest Posts
Article information

Author: Catherine Tremblay

Last Updated:

Views: 5669

Rating: 4.7 / 5 (67 voted)

Reviews: 82% of readers found this page helpful

Author information

Name: Catherine Tremblay

Birthday: 1999-09-23

Address: Suite 461 73643 Sherril Loaf, Dickinsonland, AZ 47941-2379

Phone: +2678139151039

Job: International Administration Supervisor

Hobby: Dowsing, Snowboarding, Rowing, Beekeeping, Calligraphy, Shooting, Air sports

Introduction: My name is Catherine Tremblay, I am a precious, perfect, tasty, enthusiastic, inexpensive, vast, kind person who loves writing and wants to share my knowledge and understanding with you.