Re: mass import to table with unique index

Поиск
Список
Период
Сортировка
От Manfred Koizar
Тема Re: mass import to table with unique index
Дата
Msg-id j0vh3v8kmmf4n759qhb855bgijutojmk32@4ax.com
обсуждение исходный текст
Ответ на Re: mass import to table with unique index  (John Smith <john_smith_45678@yahoo.com>)
Список pgsql-general
On Thu, 30 Jan 2003 01:41:51 -0800 (PST), John Smith
<john_smith_45678@yahoo.com> wrote:
>> I think that what the OP is looking for is the SQL*Server equivalent of
>> option IGNORE_DUP_KEY, where if you try to insert a record with that key
>> already included, it simply ignores that record.
>
>Exactly :)

John,  import into a temporary table and then

INSERT INTO original_table
SELECT DISTINCT ON (your, uniq, cols) *
  FROM temp_table t
 WHERE NOT EXISTS (
    SELECT * FROM original_table o
     WHERE o.your=t.your AND o.uniq=t.uniq AND o.cols=t.cols)
 ORDER BY your, uniq, cols, whatever;

HTH.
Servus
 Manfred

В списке pgsql-general по дате отправления:

Предыдущее
От: Justin Clift
Дата:
Сообщение: Re: donations?
Следующее
От: "Peter Gibbs"
Дата:
Сообщение: Re: 'GROUP BY' problem