SQL UCASE( ) Function

The UCASE() function converts the value of a field to uppercase.

SQL UCASE() Syntax

SELECT UCASE(column_name) 
FROM table_name;

Syntax for SQL Server

SELECT UPPER(column_name) 
FROM table_name;

SQL UCASE() Example

We have the following "Subject" table:
Subject_No
Subject_Name
Dept_Name
SU01
Limit Process
Mathematics
SU02
Linear Programming
Mathematics
SU03
Atomic and Molecular Structure
Chemistry
SU04
Cell Biology
Botany
SU05
Genetics
Zoology
SU06
Computer Architecture
Computer Science
SU07
Relativity and structure of matter
Physics


Now we want to select the content of the "Subject_Name" and "Dept_Name" columns above, and convert the " Subject_Name " column to uppercase.
We use the following SELECT statement:

SELECT UCASE(Subject_Name) AS Subject_Name,Dept_Name 
FROM subject;

The result-set will look like this:

Subject_Name
Dept_Name
LIMIT PROCESS
Mathematics
LINEAR PROGRAMMING
Mathematics
ATOMIC AND MOLECULAR STRUCTURE      
Chemistry
CELL BIOLOGY
Botany
GENETICS
Zoology
COMPUTER ARCHITECTURE
Computer Science
RELATIVITY AND STRUCTURE OF MATTER
Physics

Post a Comment

Thank you for vising

Previous Post Next Post