Home » SQL UPPER()

SQL UPPER()

SQL UPPER() function converts all the characters in a string into uppercase.





Syntax

UPPER(input string)

Lets look at an example of UPPER() function in SQL.

Following statement uses UPPER function and converts all the character in string into uppercase.

DECLARE @String AS VARCHAR(10)='microsoft'

SELECT @String AS [String], UPPER(@String) AS [Output]

select * from categories ;

 

 


 

Converts column values to uppercase using UPPER Function

Lets Create a table named NameList and Insert some records into this.

CREATE TABLE dbo.NameList
(Id INT, 
Name VARCHAR(50)
)

INSERT INTO dbo.NameList
(Id, Name)
VALUES
(1, 'Jack Hanery'),
(2, 'Joshep Mac'),
(3, 'Rozer Jr'),
(4, 'Mustafha Md.')

Now we have a table as shown below.

SELET * from dbo.NameList

Lets converts the Column Name values into uppercase using UPPER function.

SELECT Id, Name, UPPER(Name) AS [Name_In_Uppercase]
FROM dbo.NameList

As you can see, name values are converted into uppercase.

SQL LOWER() Function




2 thoughts on “SQL UPPER()”

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.