Importing Raw Data
Go Up to Exporting and Importing Raw Data
To import raw data, you will need TIBSQL, TIBDatabase, and TIBTransaction components. Associate the components with each other, select a destination database, and set the connections to active.
- Tip: Use the Database Editor to set up the database component. To start the Database Editor, right click the database component with the mouse and select Database Editor from the drop-down menu.
It is important to note that you must import data into a table with the same column definitions and data types, and in the same order; otherwise, all sorts of unpredictable and undesirable results may occur.
The following code snippet inputs selected data with an SQL INSERT statement from the source_raw file created in the last example into the DESTINATION table.
procedure TForm1.Button2Click(Sender: TObject); var RawInput : TIBInputRawFile; begin IBSQL2.SQL.Text := 'Insert into Destination values(:name, :number, :hired)'; RawInput := TIBInputRawFile.Create; try RawInput.Filename := 'source_raw'; IBSQL2.BatchInput(RawInput); finally RawInput.Free; end;