|
|
Sponsor |
Re: Access - ODBC - serial problem...: msg#00061db.postgresql.odbc
The problem, as I see it, is that you are creating a table that will have multiple instances of the same value for code Your return for the query 'select id where code = 20' will return a result set, not a singleton response. This will not tell you what the latest value of id was, only all values. If you normalize your table on code (i.e., make code a unique value) you will always get a singleton response to your query. However, you will get an error that you will have to trap, when you try to insert duplicate values into the table.CREATE TABLE public.test ( id serial PRIMARY KEY, code int4, f1 int4, f2 varchar(50), f3 text ) WITHOUT OIDS; My solution, and I work in Delphi, not Access, so I can't tell you how access will work with this, is to create a function in postgres that inserts your values and returns currval(''id''). Currval is always the id you just inserted into the table. You then call the function as a stored procedure (or whatever its equivalent is in Access), with the proper parameters, and you get the id you just inserted to work with. Check the docs for proper syntax on writing the function and using currval. HTH Richard Huxton wrote: On Thursday 08 April 2004 13:23, Philippe Lang wrote:
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Access - ODBC - serial problem..., Richard Huxton |
|---|---|
| Next by Date: | Re: Access - ODBC - serial problem..., Shachar Shemesh |
| Previous by Thread: | Re: Access - ODBC - serial problem..., Richard Huxton |
| Next by Thread: | Re: Access - ODBC - serial problem..., Shachar Shemesh |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
Free MagazinesCisco NewsReceive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business. subscribe Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field. subscribe The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business. subscribe Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company. subscribe Total Telecom Total Telecom is "The Economist of the communications industry". subscribe |
Home | sitemap
| advertise | OSDir is
an inevitable website.
|