SQL Help - Obtaining ID of record INSERTED

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings.

INSERT INTO
   orderstemp (customerid,datecreated)
VALUES
   ('5443','8/16/2005 12:00PM')

The table orderstemp has a unique identifier field, orderid (of type SERIAL).

How can I obtain the orderid of the record inserted in the INSERT INTO statement in postgresql?

MSSQL does it like this:

INSERT INTO
   orderstemp (customerid,datecreated)
VALUES
   ('5443','8/16/2005 12:00PM')
SELECT @@identity as orderid

but this doens't work in postgresql.

Any ideas?  Thanks in advance.


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux