Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2002
    Posts
    229

    Unanswered: Checking last user Identity on remote server

    Is it possible to get the latest inserted Identity value on a remote server?

    (The following gives a NULL result:

    select ident_current('[my_linked_server].thedatabase.dbo.thetable')

    )

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    @@IDENTITY (assuming you mean server wide irrespective of the user\ connections etc).

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Beg your pardon - @@Identity is specific to session - sorry - didn't read every last line of BoL before hitting Submit.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Jul 2002
    Posts
    229
    Quote Originally Posted by pootle flump
    @@IDENTITY (assuming you mean server wide irrespective of the user\ connections etc).
    HTH
    Are you sure? I think that's what I tried first. Doesn't
    it give the latest Id value used in the server where
    you are (so to speak), not the remote server?

  5. #5
    Join Date
    Jul 2002
    Posts
    229
    Finally, I understood this is the way to do it. Just as feedback.

    DECLARE @return_status int
    EXEC @return_status = MyLinkedServer.the_database.dbo.a_stored_procedure
    SELECT 'Return Status' = @return_stat

    The SP "a_stored_procedure" is stored on the linked server. It returns
    Ident_Current for the appropriate table, using RETURN, simply.

Posting Permissions

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