Subject Re: [IBO] Mainly SQL help needed
Author Geoff Worboys
> 1) I want to extract data from an MSSQL 2000 batabase
> and load it into Interbase, it is very very slow about
> 10 records a second. Currently I use a Findnext loop
> (BDE) and in the loop Insert/Post to interbase (IBO).

Run the loop without the Insert/Post stuff - how fast does it go?
If it is still slow then you have a problem with your MSSQL stuff and
I cant offer much help - although I would advice NOT using FindNext
unless there is some sort of filtering required.

If the problem appears to be that the Insert/Post is very slow then we
may need more detail. Initial advice would be to be sure that you are
using either TIB_Cursor or TIB_DSQL to perform your inserts (see the
various sample applications that come with IBO). If you try to use
TIB_Query or TIBOQuery then you will be buffering (and possibly
refresshing) records as you insert and that will slow things down.

> 2) How do I check, in Delphi, if a table or trigger
> etc exists.

For triggers you would need to query the metadata directly (see the
IB language guide). See documentation links offered below.

For tables you can let IBO take care of the details for you. See the
TIB_Connection.SchemaCache property (lookup TIB_SchemaCache for all
the properties and methods available - such as TableNames).

> 3) How do I assign the result of 'Select count(*) from
> Student' to a Delphi variable.

Depends on the context - in many/most situations it is not needed or
recommended. So perhaps you should explain why you want it.

However given that you do want it then setup the query into a
TIB_DSQL, ExecSQL then read back Fields.Columns[0].AsInteger;

Again; refer to the doco links given below.

> 4) How do I obtain the date from the 'Datepick'
> component.

If you look at the source DatePick.pas, you will see that TDatePick
has a public property "Date".

> I borrowed three SQL manuals from the Uni library but
> they did not have the answer.

The following documentation links may help...

IBObjects Related:

- The IBO online help

- The release notes (distributed in the IBO Source as

- FAQ and Tech Sheet information at

- the samples and tutorials distributed with IBO

Interbase/Firebird Related:

- The firebird website:
(see links to "Documentation" and "Novice's Guide").

In particular most people should download and have as reference
the IB6Beta documentation available from:

Other Useful Sites:

- IBPhoenix:

- Claudio Valderrama's resource site:

- Ivan Prenosil's site:


Geoff Worboys
Telesis Computing