CREATE TABLE TestOne (id INT IDENTITY,SomeDate DATETIME)
CREATE TABLE TestTwo (id INT IDENTITY,TestOneID INT,SomeDate DATETIME)
INSERT TestOne VALUES(GETDATE())
INSERT TestOne VALUES(GETDATE())
INSERT TestOne VALUES(GETDATE())
INSERT TestOne VALUES(GETDATE())
@@IDENTITY
SELECT @@IDENTITY
DBCC CHECKIDENT
DBCC CHECKIDENT (TestOne, NORESEED)
MAX FUNCTION
SELECT MAX(id) FROM TestOne
TOP 1 AND ORDER BY DESC
SELECT TOP 1 id FROM TestOne ORDER BY id DESC
IDENT_CURRENT
SELECT IDENT_CURRENT('TestOne')
SCOPE_IDENTITY
SELECT SCOPE_IDENTITY()