Re: getting back autonumber just inserted
От | Theodore Petrosky |
---|---|
Тема | Re: getting back autonumber just inserted |
Дата | |
Msg-id | 20050707201433.94901.qmail@web41013.mail.yahoo.com обсуждение исходный текст |
Ответ на | getting back autonumber just inserted (mail TechEvolution <mail@techevolution.be>) |
Ответы |
Re: getting back autonumber just inserted
Re: getting back autonumber just inserted Re: getting back autonumber just inserted |
Список | pgsql-sql |
you have to use currval inside a transaction... begin; insert something that increments the counter; select currval('sequence_name'); end; using currval inside a transaction guarantees that the value is correct for your insert statement and has not changed by another insert statement. Ted --- mail TechEvolution <mail@techevolution.be> wrote: > hello > > i ame a newbie to PostGreSQL, I ame using PostGreSQL > 8.0 > (windowsinstaller) on a xp prof platform > > i would like to get back the autonumber from the > last record inserted, > for other SQL db (m$ sql db ...) i could use: > SELECT @@ IDENTITY > > can someone help me by informing me what the SQL > syntax is to be used > with PostGreSQL db and get the same result, the last > autonumber inserted? > > greeTz > > wes > > ---------------------------(end of > broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster > ____________________________________________________ Sell on Yahoo! Auctions no fees. Bid on great items. http://auctions.yahoo.com/
В списке pgsql-sql по дате отправления: