Skip to Content.
Sympa Menu

freetds - Re: Equivalent of mysql_insertid using FreeTDS/DBD::Sybase?

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Eric Deutsch" <edeutsch AT systemsbiology.org>
  • To: "TDS Development Group" <freetds AT franklin.oit.unc.edu>
  • Subject: Re: Equivalent of mysql_insertid using FreeTDS/DBD::Sybase?
  • Date: Mon, 30 Sep 2002 15:49:25 -0700



SELECT SCOPE_IDENTITY()

also works, and as I understand it might give a more accurate result
under some circumstances (e.g., if you INSERT into a table with a
trigger that INSERTs into another table, @@IDENTITY may give you the
IDENTITY of the trigger table insert, not the INSERT you were
performing, while SCOPE_IDENTITY() gives you the result you probably
wanted.).


> -----Original Message-----
> From: Michael Peppler [mailto:mpeppler AT peppler.org]
> Sent: Monday, September 30, 2002 3:27 PM
> To: TDS Development Group
> Subject: [freetds] Re: Equivalent of mysql_insertid using
> FreeTDS/DBD::Sybase?
>
> On Mon, 2002-09-30 at 15:19, Richard Wolfe wrote:
> >
> > ...where $newid returns the value of the auto-incrementing field.
Is
> there
> > an equivalent function in DBD::Sybase? The pod file says something
> about
> > @@IDENTITY, but I can't get this to work. Am I on the right track?
>
> Just add a "select @@identity" to your insert request, or execute the
> "select @@identity" on the same connection right after the insert is
> done.
>
> Michael
> --
> Michael Peppler / mpeppler AT peppler.org / http://www.mbay.net/~mpeppler
> mpeppler AT zetatools.com / ZetaTools, Inc / http://www.zetatools.com
> ZetaTools: Call perl functions as Sybase stored procedures!




Archive powered by MHonArc 2.6.24.

Top of Page