If you are using SQL 2000 you can use two system functions.
SELECT @NextIdent=
IDENT_CURRENT('TableName') +
IDENT_INCR('TableName')
In SQL 7, you can find the current max value and add the increment value.
SELECT @NextIdent=
Max(IdentCol) + IDENT_INCR('TableName')
FROM TableName
In any case, if the table has a lot of insert activity the value returned by these queries may be obsolete in a few milliseconds. Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.