R: [PHP-WIN] Retrieving ID after INSERT with MSSQL

From: Date: Fri, 15 Dec 2000 16:56:17 +0000
Subject: R: [PHP-WIN] Retrieving ID after INSERT with MSSQL
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-4506@lists.php.net to get a copy of this message
Thanx to all. It works great !!! Bye, Fabio > -----Messaggio originale----- > Da: Flint Doungchak [mailto:Flint@netsolutionsllc.com] > Inviato: venerdì 15 dicembre 2000 17.54 > A: 'Fabio R.'; 'PHP-Windows List (E-mail)' > Oggetto: RE: [PHP-WIN] Retrieving ID after INSERT with MSSQL > > > Fabio, > > You can use the MSSQL function > > @@IDENTITY to retrieve the last insert id of a column with an > indentity > seed. i.e. is autoincremented by SQL Server. > > So, it would look something like this... > > $query = "INSERT INTO blah values (a,b,c)"; > $result = mssql_query($query,$connect); > > $query = "SELECT @@IDENTITY"; > $whatyouwant = mssql_query($query,$connect); > > -Flint > php-list-admin@lists.php.net

« previous php.windows (#4506) next »