Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Re: Getting identity after autoincr in FreeTDS/MSSQL/DBI

by wardk (Deacon)
on Nov 09, 2001 at 22:47 UTC ( #124439=note: print w/replies, xml ) Need Help??

in reply to Re: Getting identity after autoincr in FreeTDS/MSSQL/DBI
in thread Getting identity after autoincr in FreeTDS/MSSQL/DBI

hmmm, I guess I should login before posting, if I was wrong about the above blame anonymous monk...
  • Comment on Re: Re: Getting identity after autoincr in FreeTDS/MSSQL/DBI

Replies are listed 'Best First'.
Re: Re: Re: Getting identity after autoincr in FreeTDS/MSSQL/DBI
by scain (Curate) on Nov 09, 2001 at 23:52 UTC

    I think it is different when running over freeTDS on linux, because when I tried to do it as two seperate commands, @@IDENTITY was empty. I think it has something to do with the concept of "current session", but I don't really know.

    Nice work in Identity nabber for MSSQL, by the way.


      If the value for @@identity is empty when doing this as two requests it means that the select @@identity is done on a different physical connection from the insert. This usually happens when you don't completely flush all the results after the initial insert.

      I'm thinking of adding an attribute to DBD::Sybase that would inhibit the automatic secondary connections to handle multiple concurrent $sth on a single database handle as that causes quite a lot of confusion for people...


        Since you are using two commands off one prepare, you may need to
        use the:

        while ( $someVar = $sth->fetch ) { do ( something... ) while ( $sth->{syb_more_results} );


        This is explained in the "Programming the Perl DBI" book
        PG: 326 Don't know if it helps - but it's worth a try.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://124439]
choroba still has one more.
[Corion]: I have Thursday and Friday off, so then I might get to converting the rough outlines to more articles ;)
[Corion]: But currently, most of the modules are web-related and I don't like to publish two web articles in a row
[Corion]: Maybe I should do the Filter::Simple release on the next weeked - this would give me one more article to milk from this theme

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (6)
As of 2017-04-24 08:57 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (437 votes). Check out past polls.