ROWID Function [Miscellaneous]

Returns the internal row ID value for each row of the table.

Syntax

ROWIDtable-name ) …FROM table-name

Parameters

Parameter

Description

table-name

The name of the table. Specify the name of the table within the parentheses with either no quotes or with double quotes.

Returns

UNSIGNED BIGINT

Examples

The following statement returns the row ID values 1 through 10:

SELECT ROWID( “PRODUCTS” ) FROM PRODUCTS

rowid(Products)

1

2

3

.

.

.

10

The following statement returns the product ID and row ID value of all rows with a product ID value less than 400:

SELECT PRODUCTS.ID, ROWID ( PRODUCTS )
FROM PRODUCTS
WHERE PRODUCTS.ID < 400

ID

rowid (Products)

300

1

301

2

302

 3

The following statement deletes all rows with row ID values greater than 50:

DELETE FROM PRODUCTS
WHERE ROWID ( PRODUCTS ) > 50

Usage

You can use the ROWID function with other clauses to manipulate specific rows of the table.

You must specify the FROM table-name clause.

Standards and Compatibility

  • SQL—Vendor extension to ISO/ANSI SQL grammar.

  • Sybase—Not supported by Adaptive Server Enterprise.