how to copy and insert all the values in a tuple that is having auto Id [message #19297] |
Sat, 09 March 2002 16:55 |
pranavi
Messages: 3 Registered: February 2002
|
Junior Member |
|
|
I have a table "Accountpay" with 50 field names.
every row has AUTO ID(primary key) (automatically generates the ID ).
I wanna copy all the field names in that table and insert them in the same table. but I am getting problem with the AUTO ID.
I am using this sql
insert into Accountpay
values( select * from Accountpay where columnname = '123')
|
|
|
Re: how to copy and insert all the values in a tuple that is having auto Id [message #19300 is a reply to message #19297] |
Sun, 10 March 2002 16:12 |
seng
Messages: 191 Registered: February 2002
|
Senior Member |
|
|
Here is one of method,
1. Create a duplicate table.
e.g
CREATE TABLE Accountpay1 AS SELECT * FROM Accountpay;
2. Change the AUTO ID to difference number for duplicate table and insert back into this table.
INSERT INTO Accountpay
SELECT * FROM Accountpay1 WHERE columnname = '123'
3. Reset your auto generated AUDO ID. e.g Usually reset the sequence number to prevent constraint error in future inserting.
Note: Other method is using cursor and you need PL/SQL programming.
Hope this is helping.
|
|
|