Re: COPY command
От | Michael Glaesemann |
---|---|
Тема | Re: COPY command |
Дата | |
Msg-id | 3EE27553-425F-11D8-9330-000A95C88220@myrealbox.com обсуждение исходный текст |
Ответ на | Re: COPY command (azwa@nc.com.my) |
Список | pgsql-sql |
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. > thanks. > > example : > > dwnc=# copy biosadm.custinv_temp > dwnc-# from '/home/bios/customer_data/CustomerInvoice_5Dec03_tab.txt' ; > ERROR: copy: line 1, Missing data for column "subsidiary" Just like you specify the delimiter, you need to specify the value for NULL. For example, if your *.txt file has a line with a "missing" value (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: <http://www.postgresql.org/docs/current/static/sql-copy.html> HTH Michael Glaesemann grzm myrealbox com
В списке pgsql-sql по дате отправления: