UPPER

Transact-SQL Reference

Transact-SQL Reference

UPPER

Returns a character expression with lowercase character data converted to uppercase.

Syntax

UPPER ( character_expression )

Arguments

character_expression

Is an expression of character data. character_expression can be a constant, variable, or column of either character or binary data.

Return Types

varchar

Remarks

character_expression must be of a data type that is implicitly convertible to varchar. Otherwise, use the CAST function to explicitly convert character_expression.

Examples

This example uses the UPPER and RTRIM functions to return the trimmed, uppercase author's last name concatenated with the author's first name.

USE pubs
GO
SELECT UPPER(RTRIM(au_lname)) + ', ' + au_fname AS Name
FROM authors
ORDER BY au_lname
GO

Here is the result set:

Name                                                           
-------------------------------------------------------------- 
BENNET, Abraham                                                
BLOTCHET-HALLS, Reginald                                       
CARSON, Cheryl                                                 
DEFRANCE, Michel                                               
DEL CASTILLO, Innes                                            
DULL, Ann                                                      
GREEN, Marjorie                                                
GREENE, Morningstar                                            
GRINGLESBY, Burt                                               
HUNTER, Sheryl                                                 
KARSEN, Livia                                                  
LOCKSLEY, Charlene                                             
MACFEATHER, Stearns                                            
MCBADDEN, Heather                                              
O'LEARY, Michael                                               
PANTELEY, Sylvia                                               
RINGER, Albert                                                 
RINGER, Anne                                                   
SMITH, Meander                                                 
STRAIGHT, Dean                                                 
STRINGER, Dirk                                                 
WHITE, Johnson                                                 
YOKOMOTO, Akiko                                                

(23 row(s) affected)

See Also

Data Types

String Functions