Re: Identity error?? Please help

From: Brian Hollister (bhollisterATfuturaintlDOTcom)
Date: 04/19/04

  • Next message: Del Murray: "Re: ftBCD"
    Date: Mon, 19 Apr 2004 17:43:43 -0400
    
    

    Check out @@SCOPE_IDENTITY in SQL Servers BOL maybe that will help

    "Morpheus" <morpheusNOPSAM@redpoint.co.za> wrote in message
    news:4083b79b@newsgroups.borland.com...
    > Hi Andre,
    >
    > Sounds like you're an expat now living in Aus ;-).
    >
    > I do know that in SQL Server, if you get the value of an IDENTITY column
    in
    > a trigger, depending upon which global variable you look at, you will
    always
    > get the last IDENTITY value inserted. This would be consistent with the
    > value that you are gettting back. I am not too sure how Delphi handles
    this,
    > but how are you getting the last inserted identoty value? A bit of detail
    > might help you solve the problem.
    > Regards,
    > Norman
    >
    > "Andre Greyling" <agreyling@optusnet.com.au> wrote in message
    > news:40837755@newsgroups.borland.com...
    > > Hi all
    > >
    > > I have an appplication that does an insert into a table that has an
    > identity
    > > column. In the afterpost event of the adoquery i want to get the newly
    > > inserted indentity value. Normally i don't have a problem. However, when
    I
    > > have a detail dataset hanging off it (relationship is defined using the
    > > Datasource property of the detail query) AND I have trigger on the
    master
    > > table that inserts into the detail table(which also has an identity
    > column),
    > > the value I get in my afterpost event is the value of the details
    > identity
    > > column!!!!!!!!!! What the...??? As soon as I remove the insert in the
    > > trigger, I get the correct value back (i.e. the identity value of the
    > master
    > > record).
    > >
    > > How do I overcome this problem? Any suggestions on what is the best way
    to
    > > retrieve an identity value given the above situation (I may have
    multiple
    > > detail tables of master table) or generally.
    > >
    > > Any help would be greatly appreciated
    > >
    > > TIA
    > > Andre
    > >
    > >
    >
    >


  • Next message: Del Murray: "Re: ftBCD"

    Relevant Pages

    • Re: Disaster Recovery With SQL 8.0
      ... It's a backup you need to restore it. ... > you say you don't need the master and model. ... > Here are some links to a lot of articles about moving/restoring databases ... > When a Database Is Moved Between SQL Servers ...
      (microsoft.public.sqlserver.server)
    • Re: THE BEST GUITAR SOLOS EVER !!!
      ... the scale of great guitar soloists? ... I haven't heard any improvisational works by Andre, but he was a master. ...
      (rec.gambling.poker)