Logo 
Search:

SQL Server Articles

Submit Article
Home » Articles » SQL Server » String FunctionsRSS Feeds

UPPER Function

Posted By: Sarita Patel     Category: SQL Server     Views: 2275

This article explains UPPER function of sql server with examples.

UPPER function is used to convert lower case string to upper case string.


Syntax of UPPER Function :

UPPER ( character_expression  )

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

Return type of RIGHT function is varchar.


Examples of UPPER Function :

Example 1 : Use of UPPER function in select clause

SELECT UPPER('syntax-example')  

Output
SYNTAX-EXAMPLE

Above example returns specified string in upper case.


Example 2 : Use of UPPER function to display field value of table.

SELECT UPPER(ContactName) AS 'Customer Name'    
FROM   Customers

Output
Customer Name
MARIA ANDERS
ANA TRUJILLO
ANTONIO MORENO
THOMAS HARDY
CHRISTINA BERGLUND
HANNA MOOS

Above example displays customer name in upper case of customer table.



Example 3 : Use of UPPER function in where clause

SELECT ContactName, CompanyName
FROM   Customers
WHERE  UPPER(ContactName) LIKE 'MARIA %'

Output
ContactName      CompanyName
Maria Anders      Alfreds Futterkiste
Maria Larsson     Folk och fä HB

Above example displays customers having name as 'MARIA'.
 
  
Share: 

 
 
 

Didn't find what you were looking for? Find more on UPPER Function Or get search suggestion and latest updates.

Sarita Patel
Sarita Patel author of UPPER Function is from United States.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!