CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004
    Location
    London, England
    Posts
    563

    Last identity problems

    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:

    Code:
    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:
    Code:
    SELECT @@Identity FROM <TableName>  AS UID
    But this will only give me the LAST INSERTED ID overall in the database.

    Regards

    John
    I don't mind that you think slowly but I do mind that you are publishing faster than you think. Wolfgang Pauli, physicist, Nobel laureate (1900-1958)

  2. #2
    Join Date
    Jun 2005
    Posts
    1,255

    Re: Last identity problems

    I'd try SELECT MAX(IdName) FROM TableName.

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured