Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Posts
    7

    Unanswered: Get Last Identity From Client

    I need to retrieve the identity value of a newly inserted record.
    The purpose is to use it in a master-detail relationship.

    Do i need to make need to Query the Table or is there an easier (read: better) way to do so?

  2. #2
    Join Date
    Jan 2003
    Location
    Nottinghamshire, UK
    Posts
    364

    @@IDENTITY

    After an INSERT, SELECT INTO, or bulk copy statement completes, @@IDENTITY contains the last identity value generated by the statement.

    Inline SQL "SELECT @@IDENTITY"
    "Everything should be made as simple as possible, but not simpler." - Albert Einstein
    "Everything should be made as complex as possible, so I look Cleverer." - Application Developer

  3. #3
    Join Date
    Jul 2002
    Location
    Village, MD
    Posts
    621

    Re: Get Last Identity From Client

    Check for SCOPE_IDENTITY() in BOL.

  4. #4
    Join Date
    Sep 2003
    Posts
    7
    Thanks

Posting Permissions

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