Skip to content
Related Articles

Related Articles

Improve Article

UPPER() function in SQL Server

  • Last Updated : 09 Dec, 2020

UPPER() :
This function in SQL Server helps to convert all the letters of the given string to Uppercase. If the given string contains special characters or numeric values, then they will remain unchanged by this function.

Syntax :

UPPER( str )

Parameters :

  • str – The string which will be converted to uppercase

Result :
This function will return the uppercase string.

Example-1 :
Using UPPER() function with Lowercase string.



SELECT UPPER('be patience be awake') 
As New;

Output :

New

BE PATIENCE BE AWAKE

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

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

Output :

New

EVERY DAY IS A NEW DAY

Example-3 :
Using UPPER() function with Select statement.
Create Players table and Insert value in it.

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

Inserting data into players :

Insert into Players values 
('Kane', 'Williamson', 'New Zealand')

The table will look like.

FirstnameLastnameCountry
KaneWilliamsonNew Zealand

Use of UPPER() function.

SELECT Firstname,  
      UPPER(Lastname) As New_name,  
      Country
FROM Players;

Output :

FirstnameNew_nameCountry
KaneWILLIAMSONNew Zealand

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

DECLARE @text VARCHAR(45);
SET @text = 'be happy be light ';
SELECT @text,  
      UPPER(@text) AS Upper;

Output :

Text valueUpper
be happy be lightBE HAPPY BE LIGHT
My Personal Notes arrow_drop_up
Recommended Articles
Page :