Re: Conditional query with copy command

From: Sachin Kumar <sachinkumaras(at)gmail(dot)com>
To: Holger Jakobs <holger(at)jakobs(dot)com>
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: Conditional query with copy command
Date: 2020-11-26 10:14:45
Message-ID: CALg-PKAM7rexK7fbCc9tBA4g=twPNxouRk6=OjJy0sgkNemkbw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Thanks Mr. Holger,

For the Quick reply. We are using Ver 12 and 13 so this query will work for
us.

One more if you can guide on Archiving old records from PostgreSQL Table
and Retrieving it whenever required.
Any Documentation or example on archiving records.

On Thu, Nov 26, 2020 at 3:13 PM Holger Jakobs <holger(at)jakobs(dot)com> wrote:

> Hi,
>
> Use the new syntax as of PostgreSQL 9.0:
>
> copy hk_card_master_test from
> 'C:/inetpub/wwwroot/cards/media/static/gc_card_master2L.csv' (format csv,
> header, encoding 'ISO_8859_5') where card_status = 'A'
>
> This allows a simple WHERE condition as shown.
>
>
> Am 26.11.20 um 09:27 schrieb Sachin Kumar:
>
> Hi Experts,
>
> I am uploading 10 million data using CSV, but I want to put a condition on
> a column (Card_Status) inside the CSV that only where Card_Status = A data
> should be uploaded rest data are not uploaded.
> Please guide me in modifying the query I am using to upload the data
> Query:-
> copy hk_card_master_test from
> 'C:/inetpub/wwwroot/cards/media/static/gc_card_master2L.csv' with delimiter
> ',' csv header encoding 'ISO_8859_5'
>
> --
>
> Best Regards,
> Sachin Kumar
>
> --
> Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
>
>

--

Best Regards,
Sachin Kumar

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Yambu 2020-11-26 12:59:45 Move base directory to different location
Previous Message Holger Jakobs 2020-11-26 09:42:49 Re: Conditional query with copy command