---
title: "Three Secrets About DB2 Row Id"
description: "Row is one kind of data type in DB2. This post covers the benefits of row id data type."
url: https://srinimf.com/2010/05/21/db2-_row-id/
date: 2010-05-21
modified: 2026-10-05
author: "Srini"
categories: ["DB2"]
tags: ["DB2 row id", "DB2 Tips and Solutions", "SQL row id"]
type: post
lang: en
---

# Three Secrets About DB2 Row Id

Row id in DB2 is Unique. This is one of the [data type](https://srinimf.com/2022/01/01/how-to-create-type-data-type-in-plsql/). Its value will be assigned by DB2. No need to add separate column for this in the table.

**Best Uses of Rowid:**

![DB2 row-id](https://i0.wp.com/srinimf.com/wp-content/uploads/2010/05/a1.png?resize=280%2C175&ssl=1)*DB2 row-id*

*Source: IBM*

You use the ROWID data type to uniquely and permanently to identify rows in a DB2.

1. DB2 can generate a value for the column when a row is added, depending on the option that you choose (GENERATED ALWAYS or [GENERATED BY DEFAULT](https://srinimf.com/2014/10/14/db2-identity-column/)) when you define the column. You can use a [ROWID column](https://srinimf.com/2015/05/23/alter-table-table_name-drop-column-column_name/) in a table for several reasons.
2. You can define a ROWID column to include LOB data in a table.
3. You can use direct-row access so that DB2 accesses a row directly through the ROWID column. If an application selects a row from a table that contains a ROWID column, the row ID value implicitly contains the location of the row. If you use that row ID value in the search condition of subsequent SELECT statements, DB2 might be able to navigate directly to the row.

### Share this:

-
- [Tweet](https://twitter.com/share)
- [![](https://i0.wp.com/assets.pinterest.com/images/pidgets/pinit_fg_en_rect_gray_20.png)](https://www.pinterest.com/pin/create/link/?url=https%3A%2F%2Fsrinimf.com%2F2010%2F05%2F21%2Fdb2-_row-id%2F&media=https%3A%2F%2Fsrinimf.com%2Fwp-content%2Fuploads%2F2010%2F05%2Fa1.png&description=Three%20Secrets%20About%20DB2%20Row%20Id)
-
- [Share on Tumblr](https://www.tumblr.com/share)
- [Share on WhatsApp (Opens in new window) WhatsApp](https://srinimf.com/2010/05/21/db2-_row-id/?share=jetpack-whatsapp)
- [More](#)
-

- [Print (Opens in new window) Print](https://srinimf.com/2010/05/21/db2-_row-id/?share=print)
- [Share on Reddit (Opens in new window) Reddit](https://srinimf.com/2010/05/21/db2-_row-id/?share=reddit)
- [Share on Telegram (Opens in new window) Telegram](https://srinimf.com/2010/05/21/db2-_row-id/?share=telegram)
- [Email a link to a friend (Opens in new window) Email](mailto:?subject=%5BShared%20Post%5D%20Three%20Secrets%20About%20DB2%20Row%20Id&body=https%3A%2F%2Fsrinimf.com%2F2010%2F05%2F21%2Fdb2-_row-id%2F&share=email)
-

### Like this:

Like Loading…
