Home » SQL LOWER()

SQL LOWER()

SQL LOWER() function converts all the characters in a string into lowercase.





SYNTAX

LOWER(input_string)

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

Following statement uses Lower function and converts all the character in string into lowercase.

DECLARE @String AS VARCHAR(10)='MICROSOFT'
SELECT @String AS [String], LOWER(@String) AS [Output]

As you can see, all the characters in string ‘MICROSOFT’ are converted into lowercase.

Converts column values to lowercase using LOWER 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 lowercase using LOWER function.

SELECT Id, Name, LOWER(Name) AS [Name_In_Lowercase]
FROM dbo.NameList

 

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

SQL UPPER Function



Leave a Reply

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