SQL Server UPPER() Function
The UPPER()
function in SQL Server converts a string to uppercase. This is a fundamental string manipulation function, useful for data cleaning, standardization, or case-insensitive comparisons.
UPPER(): Definition and Usage
UPPER()
transforms all lowercase characters in a string to their uppercase equivalents. This is frequently used to ensure consistency in text data, especially when comparing strings where the casing of letters shouldn't matter for the comparison.
Related Function
For converting strings to lowercase, see the LOWER()
function.
Syntax
Syntax
UPPER(text)
Parameter Values
Parameter | Description |
---|---|
text |
The string you want to convert to uppercase. This is required. |
Examples
Converting a Literal String
This example converts the sample string "SQL Tutorial is FUN!" to uppercase.
Syntax
SELECT UPPER('SQL Tutorial is FUN!');
Output
SQL TUTORIAL IS FUN!
Converting Values in a Column
This converts the values in the 'CustomerName' column of the 'Customers' table to uppercase (assuming a table named 'Customers' exists with a 'CustomerName' column).
Syntax
SELECT UPPER(CustomerName) AS UppercaseCustomerName
FROM Customers;
Output
UppercaseCustomerName
-----------------------
(Uppercase versions of all CustomerNames from the Customers table)