Returns the given character string with all characters converted to uppercase. This function is case-insensitive, meaning it works the same regardless of the original casing of the input string.
UPPER ( character_expression )
character_expression
Is a character string of any valid SQL Server data type for character strings.
Returns a character string of the same data type as the input, with all characters converted to uppercase. If the input is NULL, UPPER returns NULL.
No specific permissions are required to use the UPPER function. It can be executed by any user.
Convert a string to uppercase:
SELECT UPPER('This is a test string.');
Result:
This Is A Test String.
The following statement returns the string 'HELLO WORLD':
SELECT UPPER('hello world');
This example selects the ProductName column from the Production.Product table and converts all product names to uppercase.
SELECT
ProductID,
Name AS OriginalName,
UPPER(Name) AS UppercaseName
FROM
Production.Product
WHERE
ProductID < 10;
Sample Result (for ProductID 1):
ProductID | OriginalName | UppercaseName
----------|--------------|--------------
1 | Adjustible | ADJUSTIBLE
Demonstrates how UPPER handles NULL input:
SELECT
CASE WHEN @myVar IS NULL THEN 'NULL Input' ELSE UPPER(@myVar) END AS Result;
If @myVar is NULL, the result will be 'NULL Input'. If @myVar is 'Test', the result will be 'TEST'.