Re: Nocount and scope_identity()

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Nocount and scope_identity()
Дата
Msg-id 23776.1170448113@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Nocount and scope_identity()  (Andrew Sullivan <ajs@crankycanuck.ca>)
Список pgsql-sql
Andrew Sullivan <ajs@crankycanuck.ca> writes:
> On Fri, Feb 02, 2007 at 01:38:40PM -0600, Demel, Jeff wrote:
>>>> SCOPE_IDENTITY() method is going to work or not.

>>> I doubt it.  What does it do?
>> 
>> It returns the id of the record just inserted.

> Ah.  Well, there's no in-principle notion if "id" in Postgres (OIDs
> are optional as of several versions ago).  But if you have a primary
> key that's an integer you populate using a sequence, then you can use
> the currval() function to get the value of the sequence.

Also, as of 8.2 INSERT RETURNING is a good way to collect the value
of an auto-generated key field (or any other auto-generated field...)
        regards, tom lane


В списке pgsql-sql по дате отправления:

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: Nocount and scope_identity()
Следующее
От: "Karthikeyan Sundaram"
Дата:
Сообщение: Re: Question regarding multibyte.