Received: from bjke.com (firewall-user@ganymede.bjke.com [144.210.8.38]) by hub.org (8.9.3/8.9.1) with ESMTP id QAA55429 for ; Tue, 27 Apr 1999 16:40:52 -0400 (EDT) (envelope-from djackson@cpsgroup.com) Received: by bjke.com; id PAA01238; Tue, 27 Apr 1999 15:40:51 -0500 (CDT) Received: from unknown(144.210.12.10) by gauntlet.bjke.com via smap (4.1) id xma001152; Tue, 27 Apr 99 15:40:47 -0500 Received: by cpsmail with Internet Mail Service (5.5.2448.0) id <2D677N2W>; Tue, 27 Apr 1999 15:41:46 -0500 Message-ID: From: "Jackson, DeJuan" To: JT Kirkpatrick , "'pgsql-sql@hub.org'" Subject: RE: [SQL] incrementing by the second Date: Tue, 27 Apr 1999 15:41:39 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: text/plain > I have 96,000 records in a postgres table that has an unpopulated field > for > datetime. I need the value in that field to be unique, but the ACTUAL > value isn't really that important. I'd like to begin with the first > record, enter a date and time, and then increment that value by one second > > for the next field, one second for the next, and so on. Can I do this > directly from within psql?? I could do this in dbase w/ no problem, but > I'm really not that familiar with sql syntax. . . > > jt > You might be able to do it with a creative use of a sequence. create sequence my_seq; create table test ( my_d datetime PRIMARY KEY DEFAULT now()+(nextval('my_seq') || ' seconds'), ...) You still have problems with duplicates happening as in my reply to your othe message. you can take the default (now()+(nextval('my_seq') || ' seconds')) and use it in an INSERT statement to the same effect. -DEJ