Previous Topic

Next Topic

Inhoudsopgave

Book Index

Next_Identity

Next_Identity( table_name )

Returns the identity value to be assigned for this table (in varchar format).

Example

create table t (i numeric(10,0) Identity )

insert into t values ()

select Next_Identity('t')

drop table t

Differences

The function Next_Identity does not exist on MS SQL Server. The code fragment below can be used to emulate it.

create table t (i numeric(10,0) Identity )

insert into t default values

if (select Count(*) from t ) = 0

select Ident_Seed( 't' ) as NextIdentity

else

select Ident_Current( 't' ) + Ident_Incr( 't' ) as NextIdentity

drop table t