SQL LCASE() and SQL-Server LOWER() Function Example



SQL LCASE() and SQL-Server LOWER() Function

SQL LCASE() and SQL Server LOWER() both function used to convert text to lowercase and return it. In SQL we use LCASE() function and in sql server we use LOWER() for same purpose.

sql lcase and lower function
sql LCASE() and sql server LOWER() function
SQL LCASE() – The LCASE() function used to convert text to lowercase and return it.
The syntax of LCASE() for SQL:
SELECT LCASE(col_name) FROM Table_Name
LOWER() – The LOWER() function is used in sql server to convert text to lowercase and return it.
The syntax for LOWER() in SQL Server:
SELECT LOWER(col_name) FROM Table_Name

Here, SQL Table_Name = StudentMst

SELECT * FROM StudentMst

ID Name City Pincode Mobile
1 Meera Bombay 380022 7874555555
2 Rahul Surat 352200 7874444444
3 Jayesh Ahmedabad 352200 7874333333
4 Dhvanish Bombay 380022 7874111111
5 Reena Baroda 352222 7874666666
6 Veera Baroda 352222 7874121212

 

Below sql statement select the column Name and City from table StudentMst and convert both column to lowercase.

SELECT LCASE(Name) AS Name, LCASE(City) AS City FROM StudentMst

Name City
meera bombay
rahul surat
jayesh ahmedabad
dhvanish bombay
reena baroda
veera baroda

 

Below sql server statement select the column Name and City from table StudentMst and convert both column to lowercase.

SELECT LOWER(Name) AS Name, LOWER(City) AS City FROM StudentMst

Name City
meera bombay
rahul surat
jayesh ahmedabad
dhvanish bombay
reena baroda
veera baroda

Leave a Reply

Your email address will not be published. Required fields are marked *