On this page
Syntax
LOWER ( character_expression )
Arguments
character_expression
Is an expression of character data. It can be a constant, a variable, or a column that implicitly or explicitly converts to character data. The data types that are allowed for character_expression include char, varchar, text, nchar, nvarchar, ntext, binary, varbinary, image, timestamp, and xml.
Return Value
Returns the same type as character_expression after converting all uppercase characters to lowercase characters. If the input is NULL, NULL is returned.
Permissions
No special permissions are required. The function can be executed without granting any specific permission.
Examples
Example 1: Returning a lowercase string
The following example demonstrates how to use the LOWER function to convert a string to lowercase.
SELECT LOWER('This Is a Test String');
GO
Result:
this is a test string
Example 2: Using LOWER with a column
This example shows how to convert values from a column in a table to lowercase.
-- Assume a table named 'Products' with a column 'ProductName'
SELECT ProductName, LOWER(ProductName) AS LowercaseProductName
FROM Products;
GO
Example 3: Case-insensitive comparison
The LOWER function is often used to perform case-insensitive comparisons.
SELECT *
FROM Employees
WHERE LOWER(LastName) = 'smith';
GO
This query will return all employees whose last name is 'Smith', 'smith', 'SMITH', or any other combination of upper and lowercase characters.