In SQL Server, you can convert any lowercase string to uppercase by using the UPPER()
function.
To use it, simply pass the string as an argument when calling the function.
Syntax
Here’s the official syntax:
UPPER ( character_expression )
Where character_expression
is an expression of character or binary data. This can be a constant, variable, or column. It must be of a data type that is implicitly convertible to varchar. If not, you can use the CAST()
function to convert it.
Example
Here’s an example of UPPER()
in action:
SELECT UPPER('louder please');
Result:
LOUDER PLEASE
And we get the same result even if the original string already contains uppercase characters:
SELECT UPPER('Louder Please');
Result:
LOUDER PLEASE
Database Example
Here’s an example that returns data from a database and converts it to uppercase:
USE Music; SELECT TOP 5 AlbumName AS Original, UPPER(AlbumName) AS Uppercase FROM Albums;
Result:
Original Uppercase ---------------------- ---------------------- Powerslave POWERSLAVE Powerage POWERAGE Singing Down the Lane SINGING DOWN THE LANE Ziltoid the Omniscient ZILTOID THE OMNISCIENT Casualties of Cool CASUALTIES OF COOL
You can also use LOWER()
in the same way to convert a string expression to lowercase.