EDIT (Very Important)
It should be noted that this method can be used to predict the next id, but not gaurentee this value. The reason for this is because @marc_s is mentioned in the comments, that between the time you requested the value and the time you are using, another transaction could be inserted into this table, making the assumption that the received value is invalid.
As already mentioned, if your implementation is based on this assumption, you have made some design mistakes and should look at reworking this solution as a first priority.
From IDENT_CURRENT (Transact-SQL)
, , . .
CREATE TABLE
ID INT IDENTITY(1,1),
Val INT
)
INSERT INTO
INSERT INTO
INSERT INTO
SELECT * FROM
DELETE FROM
SELECT * FROM
SELECT IDENT_CURRENT('#Table')
DROP TABLE