How to use LOWER in Sql Server



SQL Server provides the lower function to transform a string into all lower case letters. In this article, we will learn how to use LOWER in SQL Server.

The Syntax

The basic syntax of a LOWER is as follows:

  • string: The string or varchar you want to lower case.

Getting Setup

For this, we will be using docker. This is recommended for more than just using SQL Server. To find how to install docker go here:

Now create a file called docker-compose.yml and add the following.

version: "3.9"
    image: ""
      - 1433:1433
        SA_PASSWORD: "Your_password123"
        ACCEPT_EULA: "Y"

Open a terminal and go to the folder the file is located. Then run the following.

docker-compose up

If you are looking for another good reference, you can check here:

Basic Example

The simple example is to lower case a string literal. Here is an example.

select lower('Hello World!') as lower_string;
hello world!

Lower on a Table Column

We can also run lower on a column. Below we create an employee table.

CREATE TABLE employees (
    first_name VARCHAR (50) NOT NULL,
    last_name VARCHAR (50) NOT NULL

insert into employees (first_name, last_name) 
	('Keith', 'Holliday'),
	('Jon', 'Doe'),
	('Jane', 'Doe');

We can now run the lower function on the columns.

  lower(first_name) as FirstName,
	lower(last_name) as LastName
from employees e;
FirstName LastName
keith holliday
jon doe
jane doe