DB2 Tutorial

  • Home
  • Start Here
  • Basics
  • Views
  • Triggers
  • Indexes
  • Functions
    • Aggregate Functions
    • Date Functions
    • String Functions
    • Window Functions
Home » Db2 String Functions » Db2 INITCAP

Db2 INITCAP

Summary: in this tutorial, you will learn how to use the INITCAP() function to convert a string to proper case.

Db2 INITCAP() function overview

The INITCAP() function converts the first character in each word in a string to uppercase and converts other characters in each word to lowercase. In other words, the INITCAP() function converts a string to a title case or proper case.

The following illustrates the syntax of the INITCAP() function:

INITCAP(string)

In this syntax, you specify the string that you want to convert to title case.

Db2 INITCAP() function examples

Let’s take some examples of using the INITCAP() function.

1) Using Db2 INITCAP() function to convert a literal string to title case

This example uses the INITCAP() function to convert the string ‘this is a test’ to title case:

SELECT INITCAP('this is a test') FROM SYSIBM.SYSDUMMY1;

Here is the output:

RESULT -------------- This Is A Test

2) Using Db2 INITCAP() function with table data example

This example uses the INITCAP() function to convert the book title from the books table in the sample database to title case:

SELECT INITCAP(title) FROM books ORDER BY title;

The output is as follows:

db2 initcap function example

In this tutorial, you have learned how to use the Db2 INITCAP() function to convert a string to title case.

  • Was this tutorial helpful ?
  • YesNo
Previous Db2 CONCAT
Next Db2 REPLACE

Getting Started

  • What is Db2
  • Installing Db2 Database Server
  • Db2 Sample Database
  • Creating a Db2 Sample Database
  • Connecting to a Db2 Database
  • Interacting with Db2 using SQL Developer

Data Manipulation

  • SELECT
  • ORDER BY
  • WHERE
  • SELECT DISTINCT
  • AND
  • OR
  • BETWEEN
  • LIKE
  • IN
  • LIMIT
  • FETCH
  • Join
  • INNER JOIN
  • LEFT JOIN
  • RIGHT JOIN
  • FULL OUTER JOIN
  • Self-Join
  • CROSS JOIN
  • GROUP BY
  • Subquery
  • HAVING
  • UNION
  • INTERSECT
  • EXCEPT
  • Common Table Expression or CTE
  • INSERT
  • INSERT Multiple Rows
  • INSERT INTO SELECT
  • UPDATE
  • DELETE

Managing Database Objects

  • CREATE TABLE
  • Identity Columns
  • ALTER COLUMN
  • ADD COLUMN
  • DROP COLUMN
  • DROP TABLE
  • TRUNCATE TABLE
  • RENAME TABLE

Db2 Constraints

  • Primary Key
  • Foreign Key
  • DEFAULT
  • NOT NULL
  • CHECK
  • UNIQUE

Db2 Data Types

  • Integer
  • Decimal
  • VARCHAR
  • CHAR
  • DATE
  • TIME
  • TIMESTAMP

Useful Functions & Expressions

  • CAST
  • CASE Expression
  • COALESCE

About db2tutorial.com

The db2tutorial.com website provides you with a comprehensive IBM DB2 tutorial with many practical examples and hands-on sessions.

Recent Tutorials

  • Db2 Functions
  • Db2 RANK
  • Db2 ROW_NUMBER
  • Db2 Window Functions
  • What is Db2

Site Links

  • Home
  • About Us
  • Contact Us
  • Privacy Policy
Copyright © © 2021 by www.db2tutorial.com. All Rights Reserved.