Open In App

LOWER() function in SQL Server

Last Updated : 17 Jun, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

LOWER() : 
This function in SQL Server helps to convert all the letters of the given string to lowercase. If the given string contains characters other than alphabets, then they will remain unchanged by this function. 

Syntax : 
 

LOWER( str )



Parameters : 
 

  • str - The string which will be converted to lowercase



Result : 
This function returns the lowercase string. 

Example-1 : 
Using LOWER() function with Uppercase string. 
 

SELECT LOWER('WAKE UP AND TAKE UP') 
As New;


Output : 



 

New

wake up and take up




Example-2 : 
Using LOWER() function with Mixed case string. 
 

SELECT LOWER('EvERy DAy iS A NEW day') 
As New;


Output : 



 

New

every day is a new day




Example-3 : 
Using LOWER() function with Select statement. Now, let's Create Players table and Insert value in it. 
 

Create table Players
(
 Firstname varchar(40),
 Lastname varchar(40),
 Country varchar(40)
)



Inserting Value : 
 

Insert into Players values 
('VIRAT', 'KOHLI', 'INDIA')


Output : 
The table will look like as follow. 



 

FirstnameLastnameCountry
VIRATKOHLIINDIA




Use of LOWER() function : 
 

SELECT LOWER(Firstname) 
As firstname,  
Lastname,  
Country
FROM Players;


Output : 



 

firstnameLastnameCountry
viratKOHLIINDIA




Example-4 : 
Using LOWER() function in a Variable. 
 

DECLARE @text VARCHAR(45);
SET @text = 'LIFE IS AWESOME IF YOU LIVE ';
SELECT @text,  
      LOWER(@text) AS Lower;


Output : 



 

text valueLower
LIFE IS AWESOME IF YOU LIVElife is awesome if you live


 


Next Article

Similar Reads