Re: last_insert_id() / MSSQL



On Fri, 2005-04-29 at 15:08, Ing. Branislav Gerzo wrote:
> Hello all,
>
> I connect to MSSQL via ODBC, exist some method to get last inserted
> id? I read in DBI docs:
>
> For some drivers the value may only be available if placeholders have
> not been used (e.g., Sybase, MS SQL). In this case the value returned
> would be from the last non-placeholder insert statement.
>
> So I will to have using "select max($field) from $table" 'method' ?

No - just do a "select @@identity" to get the latest value.

Michael
--
Michael Peppler - mpeppler@xxxxxxxxxxx - http://www.peppler.org/
Sybase DBA/Developer
Sybase on Linux FAQ: http://www.peppler.org/FAQ/linux.html


.



Relevant Pages

  • Re: SQL Server--> Sybase linked server
    ... Can you create an ODBC data source connecting to Sybase? ... > drivers not installed with ASE or how can i get the ...
    (microsoft.public.sqlserver.server)
  • last_insert_id() / MSSQL
    ... I connect to MSSQL via ODBC, exist some method to get last inserted ... I read in DBI docs: ... For some drivers the value may only be available if placeholders have ...
    (perl.dbi.users)
  • Re: SQL Server--> Sybase linked server
    ... I think you have to check for the Open Client for ASE 12.5, with Sybase. ... Sybase ODBC comes with Open Client. ... >> drivers not installed with ASE or how can i get the ...
    (microsoft.public.sqlserver.server)
  • RE: ODBC Error with Sybase from Win2K Server (but works from WinXP!)
    ... I'd like to know if you create a DSN in odbc ... When configuring the DSN for the ODBC connection to Sybase, ... SQL Server connection. ... >> HOWEVER, exeute the same stored proc on my workstation (WinXP Pro SP1, ...
    (microsoft.public.sqlserver.odbc)
  • Re: Sybase Source. What "data flow source" to use?
    ... Is there not a Sybase OLE DB Driver? ... I've been so excited about SSIS and telling my co-workers how ... Sybase seems like a no-brainer need to me. ... that the connection is valid and and I'm even able to get the ODBC ...
    (microsoft.public.sqlserver.dts)