SQL UCASE, SQL UPPER

The SQL UCASE, or SQL UPPER function is used to convert a string to upper case. In SQL Server, it uses the UPPER function.

SQL UCASE, SQL UPPER Syntax

SELECT UCASE(string_expression)
FROM table_name

OR in SQL Server:

SELECT UPPER(string_expression)
FROM table_name

SQL UCASE, SQL UPPER Example

Table: Employees

EmployeeId FirstName LastName Department
203 Mazojys Fxoj Finance
204 Jozzh Lnanyo Finance
205 Syllauu Dfaafk Finance
206 Gecrrcc Srlkrt Finance
302 Jssme Bdnaa Development
303 Dnnaao Errllov Development
304 Tyoysww Osk Development

We want to convert Department to upper case:

SELECT EmployeeId, FirstName, LastName, UCASE(Department) AS Department
FROM Employees

The result will look like:

EmployeeId FirstName LastName Department
203 Mazojys Fxoj FINANCE
204 Jozzh Lnanyo FINANCE
205 Syllauu Dfaafk FINANCE
206 Gecrrcc Srlkrt FINANCE
302 Jssme Bdnaa DEVELOPMENT
303 Dnnaao Errllov DEVELOPMENT
304 Tyoysww Osk DEVELOPMENT

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>