By using name of the table as an argument to IDENT_CURRENT and IDENT_INCR functions you can figure out what will be next value of identity. Following sample shows next value of identity that will be used if you add a record to Employee table in Northwind database:
You can not simply add 1 to a return value of Max ID because although uncommon it is possible to set a increament of 2. So you can simply add return values from these two functions, which SQL Server engine uses behind-the-scenes anyways.
get the next value of identity
Waleed Seada
By using name of the table as an argument to IDENT_CURRENT and IDENT_INCR functions you can figure out what will be next value of identity. Following sample shows next value of identity that will be used if you add a record to Employee table in Northwind database:
USE Northwind
GO
SELECT IDENT_CURRENT('Employees') + IDENT_INCR('Employees')
You can not simply add 1 to a return value of Max ID because although uncommon it is possible to set a increament of 2. So you can simply add return values from these two functions, which SQL Server engine uses behind-the-scenes anyways.
waldedg
sj2509
Mary Lindholm
blackpenny15
This gives the current max, so add 1 for the next value.
gorance