Subject Re: [firebird-support] Re: Problem in Bulk Insertion in Firebird - Please Help
Author Svein Erling Tysvaer
Manish Lal Joshi wrote:
>>> Now after i created the external table,
>>> i queried the table like select col1,col2 from ext_table
>>> while(
>>> {
>>> (a) getvalues
>>> (b) typecast it
>>> (c) insert into my real table.
>>> }
>> Here is where you have made a mistake...
>> Use the server to do the work.
>> Use a single statement to insert all rows from your external table,
>> something like:
>> insert into Table (ColumnA, ColumnB, ColumnC) select ColumnA, ColumnB,
>> ColumnC from ExternalTable
> But i also have to typecast the columns values.
> In my external table two fields are of type char[19] and char[256];
> They contain biginteger value and string each
> Now my internal table contains bigint and varchar()
> so i have to contert the values to these before inserting..
> Any idea..? Please help me..

insert into Table (ColumnA, ColumnB)
select cast(ColumnA as BIGINT), ColumnB from ExternalTable

Numbers must be converted, varchars shouldn't be neccessary to convert.