วันพฤหัสบดีที่ ๒๔ มีนาคม พ.ศ. ๒๕๔๘

Getting the Next ID in a SQL Server Identity

If you have a field in SQL Server that has an auto-incrementing field or an "Integer with Identity", you can retrieve the next ID in the sequence by simply calling @@IDENTITY.

For example this SQL statement:

Select @@IDENTITY

Would return back a single record that would contain the next number in the sequence.

from Abstractvb.com