distal-attribute
distal-attribute
distal-attribute
distal-attribute

insert records into newly added coulumns of existing table.

User, date Message
Written by danamma123
8 months ago
Category: General
3 posts since Tue, 07 Jan 14
Hi all,
I want to add new columns and insert some records(withou affecting existing columns) into those coulumns with existing table.. can any one help me out for this.
Written by jfalchMoney, Euro
8 months ago
406 posts since Sat, 17 Oct 09
add new columns: select table in the tree on the left; click on "Table" tab on the upper right; click on Columns: "Add" button in the middle right.

insert records: select table in the tree on the left; click on "Data" tab on the upper right; in the button panel on top, click "Last" button ( >| ), then click "Insert" button ( + ). Enter first field, press tabe, secosnd field, ...; when finished with fields, press Enter.
Written by danamma123
8 months ago
3 posts since Tue, 07 Jan 14
Hi jfalch, thanks for ur reply.. i needed dynamic sql querry. can u please help me out for the required..
Written by jfalchMoney, Euro
8 months ago
406 posts since Sat, 17 Oct 09
add new columns: cf ALTER TABLE ADD COLUMN ....

modify existing records, set new columns only: generate appropriate UPDATE statements where the SET clause specifies only the new columns. You must have an unique key in the existing records for this to work - eg generate
UPDATE yourtable SET newcol1=value1, newcol2=value2 ... WHERE keyfield=keyvalue
for each existing record.
Written by danamma123
8 months ago
3 posts since Tue, 07 Jan 14
if there only few a records then i can use "UPDATE" cluase. But if there are millions of records exists in that table, its not the perfect way to write "UPDATE" cluase for all records.
Written by jfalchMoney, Euro
8 months ago
406 posts since Sat, 17 Oct 09
AFAIK there is no other way. if you want to change existing records, you have to use UPDATE; the only alternative that I could think of is: you could export the table (using INSERTs), and then modify every INSERT line in the exported file with a program (appending new column values before the ')' at the end of each INSERT clause), then TRUNCATE the table, and load the modified import file.
 

Please login to leave a reply, or register at first.