Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 22880 invoked from network); 12 Jan 2008 15:51:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Jan 2008 15:51:12 -0000 Received: (qmail 12095 invoked by uid 500); 12 Jan 2008 15:51:00 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 12065 invoked by uid 500); 12 Jan 2008 15:51:00 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 12054 invoked by uid 99); 12 Jan 2008 15:51:00 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Jan 2008 07:51:00 -0800 X-ASF-Spam-Status: No, hits=2.6 required=10.0 tests=DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 12 Jan 2008 15:50:47 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1JDid5-0000ZH-TI for derby-user@db.apache.org; Sat, 12 Jan 2008 07:50:39 -0800 Message-ID: <14775039.post@talk.nabble.com> Date: Sat, 12 Jan 2008 07:50:39 -0800 (PST) From: Jim Murphy To: derby-user@db.apache.org Subject: Generate primary key ids on insert? MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Nabble-From: jim.murphy@pobox.com X-Virus-Checked: Checked by ClamAV on apache.org I'm writing a transformation script to migrate older DB instances to our new schema. PArt of that requires inserting data from one table into another: insert into foo select a,b,c from bar My touble is that foo has a primary key column 'id' that needs id values set. I have NOT parked this calumn as auto incrementing since when the db is really in use the incrementing is done by hibernate and the state stored int he hibernate_unique_key tabel that holds the current hi value. Anyone know of some modification to the insert statement that would allow me to generate an integer? I know the valid ranges, I just need to be able to insert a different valid int for each row. This might be a stupid question that is solved with simple sql - but this is not my forte so hopefully I'm missing the easy answer. FWIW, I'm toyed with the idea of altering the table's ID column (add increment by) for the transform then alter it back but there doesn't seem to be a way to "drop" increment by - but please correct me if I'm wrong on that. -- View this message in context: http://www.nabble.com/Generate-primary-key-ids-on-insert--tp14775039p14775039.html Sent from the Apache Derby Users mailing list archive at Nabble.com.