Click to See Complete Forum and Search --> : Last identity problems


Vaderman
July 27th, 2005, 07:05 AM
I've setup a method that I would like to get the last identity of a table NOT the last identity overall. If working with SQL 2000+ I can use:


IDENT_CURRENT('<TableName>')

This would return me the last identity inserted on the named table. Is there an equivalent using M$ Jet 4+?

At the moment I am using the following:

SELECT @@Identity FROM <TableName> AS UID

But this will only give me the LAST INSERTED ID overall in the database.

Regards

John

olivthill
July 27th, 2005, 07:57 AM
I'd try SELECT MAX(IdName) FROM TableName.

There are other methods described at http://dev.mysql.com/doc/mysql/en/getting-unique-id.html and http://objectsharp.com/blogs/bruce/articles/210.aspx