Row ID in DB2 for Mainframe

Row id in DB2 is Unique. This is one of the data type. 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
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) when you define the column. You can use a ROWID column 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.
Advertisements

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.