How to copy a table to another (firebird) database?
Posted: Wed 28 Dec 2016 04:31
In an old entry on this forum you list some code to copy a table to another database. This code no longer works.
The old example you used (in part)
The FieldByName('DATA_TYPE') returns a number and thus is no good in the script to create a new table. eg something like this is generated
Can you provide an example where I can copy a table?
The old example you used (in part)
Code: Select all
SQL := 'CREATE TABLE ' + TableName + ' ('#13#10;
while not UniMetaDataSrc.Eof do begin
SQL := SQL + UniMetaDataSrc.FieldByName('COLUMN_NAME').AsString + ' ' +
UniMetaDataSrc.FieldByName('DATA_TYPE').AsString;
if Pos('CHAR', UniMetaDataSrc.FieldByName('DATA_TYPE').AsString) > 0 then
SQL := SQL + '(' + UniMetaDataSrc.FieldByName('DATA_LENGTH').AsString + ')';Code: Select all
CREATE TABLE HTRXTBL ('#$D#$A'HTRX_ID 8,'#$D#$A'HTRX_TRX_DATE 35, .. ... etc