X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3F7D7D1B4E1 for ; Fri, 9 Jan 2004 04:50:42 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 42782-01 for ; Fri, 9 Jan 2004 00:49:52 -0400 (AST) Received: from smtp-send.myrealbox.com (smtp-send.myrealbox.com [192.108.102.143]) by svr1.postgresql.org (Postfix) with ESMTP id 8FE6ED1B454 for ; Fri, 9 Jan 2004 00:49:51 -0400 (AST) Received: from [10.10.14.130] glaesema@smtp-send.myrealbox.com [61.115.206.98] by smtp-send.myrealbox.com with NetMail SMTP Agent $Revision: 3.48 $ on Novell NetWare; Thu, 08 Jan 2004 21:49:46 -0700 In-Reply-To: References: Mime-Version: 1.0 (Apple Message framework v609) Content-Type: text/plain; charset=ISO-8859-1; format=flowed Message-Id: <3EE27553-425F-11D8-9330-000A95C88220@myrealbox.com> Content-Transfer-Encoding: quoted-printable Cc: pgsql-sql@postgresql.org From: Michael Glaesemann Subject: Re: COPY command Date: Fri, 9 Jan 2004 13:49:45 +0900 To: azwa@nc.com.my X-Mailer: Apple Mail (2.609) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/63 X-Sequence-Number: 16456 On Jan 9, 2004, at 1:11 PM, azwa@nc.com.my wrote: > how do we run the COPY command from file which has several null > columns in each field. =A0 > thanks. > > example : > > =A0 =A0dwnc=3D# copy biosadm.custinv_temp > dwnc-# from '/home/bios/customer_data/CustomerInvoice_5Dec03_tab.txt' ; > ERROR: =A0copy: line 1, Missing data for column "subsidiary" =A0 Just like you specify the delimiter, you need to specify the value for=20 NULL. For example, if your *.txt file has a line with a "missing" value=20 (such as the space between 'bar' and 'foofoo') foo bar foofoo barbar I usually use 'NULL' as NULL, so the line would be foo bar NULL foofoo barbar then use the COPY command with NULL AS 'NULL' Check out the following link for detailed info on the COPY command: HTH Michael Glaesemann grzm myrealbox com