Обсуждение: copying from one table to another

Поиск
Список
Период
Сортировка

copying from one table to another

От
Omega Weapon
Дата:
I have two identical tables -- section and
temp_section.  I use the section table for keeping
original values and temp_section for editing.

How do I copy the values from temp_section to section?

=====
Weapon
__________________________________________________
Do You Yahoo!?
Bid and sell for free at http://auctions.yahoo.com

Re: [GENERAL] copying from one table to another

От
Charles Tassell
Дата:
Try something like:

INSERT INTO selection (fieldlist) SELECT fieldlist from temp_section;

SELECT INTO won't work, as it requires you to be creating the destination
table (well, you could drop temp_section first, but that could be annoying.)

At 11:51 PM 10/5/99, Omega Weapon wrote:
>I have two identical tables -- section and
>temp_section.  I use the section table for keeping
>original values and temp_section for editing.
>
>How do I copy the values from temp_section to section?
>
>=====
>Weapon
>__________________________________________________
>Do You Yahoo!?
>Bid and sell for free at http://auctions.yahoo.com
>
>************
>


Re: [GENERAL] copying from one table to another

От
tolik@aaanet.ru (Anatoly K. Lasareff)
Дата:
>>>>> "OW" == Omega Weapon <weapon_77@yahoo.com> writes:

 OW> I have two identical tables -- section and
 OW> temp_section.  I use the section table for keeping
 OW> original values and temp_section for editing.

 OW> How do I copy the values from temp_section to section?

begin;

delete from section;
insert into section select * from temp_section;

commit;