Open In App

LOWER() function in SQL Server

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 : 
 

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. 

 

Firstname Lastname Country
VIRAT KOHLI INDIA

Use of LOWER() function : 
 

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

Output : 

 

firstname Lastname Country
virat KOHLI INDIA

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 value Lower
LIFE IS AWESOME IF YOU LIVE life is awesome if you live

 

Article Tags :
SQL