X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id EB569329E58 for ; Sat, 11 Sep 2004 06:44:41 +0100 (BST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97484-05 for ; Sat, 11 Sep 2004 05:44:36 +0000 (GMT) Received: from laughter.local (unknown [61.115.206.98]) by svr1.postgresql.org (Postfix) with ESMTP id 8433E329DB7 for ; Sat, 11 Sep 2004 06:44:35 +0100 (BST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by laughter.local (Postfix) with ESMTP id 79F6C2D29D0; Sat, 11 Sep 2004 14:44:03 +0900 (JST) In-Reply-To: <000401c491c3$6f4ca240$68363c90@ad.tri.sbc.com> References: <000401c491c3$6f4ca240$68363c90@ad.tri.sbc.com> Mime-Version: 1.0 (Apple Message framework v619) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: <9622DF32-03B5-11D9-9715-000A95C88220@myrealbox.com> Content-Transfer-Encoding: 7bit Cc: From: Michael Glaesemann Subject: Re: HOW TO HANDLE ZEROS IN DATE FIELD? Date: Sat, 11 Sep 2004 14:44:02 +0900 To: "James M Doherty" X-Mailer: Apple Mail (2.619) X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200409/82 X-Sequence-Number: 18928 On Sep 3, 2004, at 11:36 PM, James M Doherty wrote: > I have a project that is taking input from another system. I have > certain > columns defined as 'Date' > > Columns. On input I will get '000000' in this field which causes the > insert > to fail. I have read the > > docs on default and it is unclear to me if this will work. Does anyone > have > experience in solving > > this problem. The other alternative I thought of was to write a > trigger to > fix it ?? 000000 is not a valid date, as you are aware :) This is often solved in the application layer by preprocessing the data, changing 000000 to NULL, for example. You may be able to do some of this preprocessing in the database itself, first loading the raw data into a temporary table and then transforming it before putting it into the desired table. Michael Glaesemann grzm myrealbox com