Обсуждение: Last serial number inserted

Поиск
Список
Период
Сортировка

Last serial number inserted

От
Eduardo
Дата:
 How can I get the last id ( serial number ) inserted. My C code is :  

res = PQexec(conn,"insert into table1 (field1) values ('value1')");


table1:     
id SERIAL,
field1 VARCHAR(10) 


Thanks
Eduardo K


Re: Last serial number inserted

От
Josh Berkus
Дата:
Eduardo,
Use the curval(serial) function.  For more information, look in the
online docs under the name of that function.  nextval(), curval() are
wonderful things!
                -Josh Berkus
-- 
______AGLIO DATABASE SOLUTIONS___________________________                                       Josh Berkus  Complete
informationtechnology      josh@agliodbs.com   and data management solutions       (415) 436-9166  for law firms, small
businesses      fax  436-0137   and non-profit organizations.       pager 338-4078                               San
Francisco