next_identity

Description

Retrieves the next identity value that is available for the next insert.

Syntax

next_identity(table_name)

Parameters

table_name

identifies the table being used.

Examples

Example 1

Updates the value of c2 to 10. The next available value is 11.

select next_identity ("t1")
t1
--------
11

Usage

Permissions

The permission checks for next_identity differ based on your granular permissions settings.

Granular permissions enabled

With granular permissions enabled, you must be the table owner, or be a user with select permission on the identity column of the table, or have manage database permission to execute next_identity.

Granular permissions disabled

With granular permissions disabled, you must be the database owner or table owner, or be a user with sa_role, or have select permission on the identity column of the table to execute next_identity.