Page 1 of 1

Inserting 1 Lac rows

PostPosted: Tue Mar 15, 2011 5:33 pm
by intelsami
Hi,

I have one task where i need to insert around 1 lac rows in a table by selecting the data from another table. I tried with
' INSERT INTO table1 (col1,col2)
SELECT col3, col4 FROM table2 WHERE cond1 = something; '

This will work if structure of table1 and table2 are same. But in our requirement we have different table structures. Can anyone help me out with this

Thanks

Re: Inserting 1 Lac rows

PostPosted: Tue Mar 15, 2011 6:12 pm
by GuyC
not true, this will work as long as col1 is compatible with col3 and col2 with col4.
There is absolutely no requirements for identical structures in your example.

Re: Inserting 1 Lac rows

PostPosted: Tue Mar 15, 2011 7:42 pm
by prino
intelsami wrote:I have one task where i need to insert around 1 lac rows in a table by selecting the data from another table. ...

It would help if you could use normal units, according to Wikipedia, "lac" i's "the scarlet resinous secretion of a number of species of insects". Never knew DB2 could store this stuff, even though is called a "Universal Database"...

Re: Inserting 1 Lac rows

PostPosted: Tue Mar 15, 2011 8:11 pm
by enrico-sorichetti
it' s the usual issue of people using local wording in a multilingual forum
from wikipedia
lac == lakh == 100000 units
crore = 100 lakhs

... always from wikipedia
... associated to the fact The Indian numbering system also uses separators differently from the Western system —
besides the three least significant digits of the integer part, a comma divides every two rather than every three digits, thus:
12,31,23,123 123,123,123

Re: Inserting 1 Lac rows

PostPosted: Wed Mar 16, 2011 4:03 am
by DFSHDC40
...so it's back to 1's and 0's - Simple, universal and does exactly what it says on the tin!