[SQL] Is this possible?

2001-05-11 Thread Wei Weng
I have a table that has a serial for primary key. Is it possible to get the new available primary key right after I insert a row of new entry? Thanks Wei ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

[SQL] Is this possible?

2009-02-16 Thread johnf
Hi, I'm not to sure this is possible. I need to replace a primary key (pkid) with the value of a different field. I have pkid = 200 attendid = 301 I need the pkid = 301 But there may or may not be a pkid that already exist that has the value of 301. The attendid is unique and the pkid data

Re: [SQL] Is this possible?

2001-05-11 Thread Roberto Mello
On Tue, May 08, 2001 at 09:16:56PM -0400, Wei Weng wrote: > I have a table that has a serial for primary key. Is it possible to get > the new available primary key right after I insert a row of new entry? Yeah. Se the documentation on triggers. -Roberto -- +| http://fslc.usu

Re: [SQL] Is this possible?

2009-02-16 Thread A. Kretschmer
In response to johnf : > Hi, > I'm not to sure this is possible. > > I need to replace a primary key (pkid) with the value of a different field. > I have > pkid = 200 > attendid = 301 > > I need the pkid = 301 > > But there may or may not be a pkid that already exist that has the value of >

Re: [SQL] Is this possible?

2009-02-17 Thread Scott Marlowe
On Mon, Feb 16, 2009 at 7:36 PM, johnf wrote: > Hi, > I'm not to sure this is possible. > > I need to replace a primary key (pkid) with the value of a different field. > I have > pkid = 200 > attendid = 301 > > I need the pkid = 301 > > But there may or may not be a pkid that already exist that ha

Re: [SQL] Is this possible?

2009-02-17 Thread johnf
On Monday 16 February 2009 10:32:26 pm A. Kretschmer wrote: > In response to johnf : > > Hi, > > I'm not to sure this is possible. > > > > I need to replace a primary key (pkid) with the value of a different > > field. I have > > pkid = 200 > > attendid = 301 > > > > I need the pkid = 301 > > > > B

Re: [SQL] Is this possible?

2009-02-17 Thread A. Kretschmer
In response to johnf : > Wow that looks like it will work - thanks. > When you say 'within a transaction' do you mean starting with > "Begin" and using "commit"? Exactly. Andreas -- Andreas Kretschmer Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header) GnuPG-ID: 0x3FFF60

[SQL] is this possible in plpgsql ?

2003-06-19 Thread Marcin Winkler
I have 1 function in pg 7.3.2. txt string have 1,2,3,.. and i would like to be similar like if 3 in (1,2,3..) then, but IF 3 in (||txt||) THEN doesn't work. There is possible to this or not ? CREATE OR REPLACE FUNCTION rek2(INT8) RETURNS text AS ' DECLARE i

Re: [SQL] is this possible in plpgsql ?

2003-06-19 Thread Richard Huxton
On Thursday 19 Jun 2003 1:38 am, Marcin Winkler wrote: > I have 1 function in pg 7.3.2. > > txt string have 1,2,3,.. and i would like to be similar like if 3 in > (1,2,3..) then, but IF 3 in (||txt||) THEN doesn't work. > There is possible to this or not ? > txt := ; >