Here's a short step-by-step walkthrough:
- disconnect users and disable incoming connections to the database
- make a copy of database file (or two copies) and work on that
- use GFIX with -v option to validate the database file
- use GFIX with -v and -f to do full validation
If problem is not too serious, you can try to backup the broken db and restore under a new name:
- use GFIX -mend to prepare corrupt database for backup
- use GBAK -b -g to backup the database. -g disables garbage collection
- use GBAK -c to restore backup to a new database.
If you succeed, you have fixed the problem and have a functional database. If not, you can try to create an empty database with the same structure and pump the data to it .
One of the reasons why backup or restore can fail is if some broken database triggers exist, and prevent connection to the database. For example, a database trigger might use some table which has a broken index, etc. To work around this, connect to database with isql tool using -nodbtriggers option and then disable those triggers. You can enable them later when you fix other problems and get a working database again.
Another reason restore might fail is when you have broken data, so some of validity constraints (check constraints, etc.) cannot be satisfied. In this case, you can try to restore your database using -N[O_VALIDITY] command switch to gbak.
If you're interested in a more detailed information of the process of fixing the database, as well as explanation of some types of corruption, take a look at the following page:
http://www.ibphoenix.com/resources/documents/search/doc_5
If all fails, you can try IBSurgeon tool, which is able to fix most problems and extract data. Also, IBSurgeon's website has a detailed
explanation of causes of database corruption and ways to fix it:
http://ib-aid.com/option,com_content/task,view/id,58/Itemid,62/
check this guide http://www.firebirdfaq.org/faq324/
While I'm pretty sure you should redesign your database at first (and probably read something on SQL basics), you can get what you want with triggers :)
This one inserts row into daily collection
with appropriate balance:
CREATE trigger masterlist_ai for masterlist
active after insert position 0
AS
begin
insert into "daily collection" ( "date", balance)
values (new."date", new.balance);
end
And this one updates balance in masterlist
after updates of daily collection
(assuming date is the primary key):
CREATE trigger "daily_collection_au" for "daily collection"
active after update position 0
AS
begin
update masterlist
set balance = new.balance
where "date" = new."date";
end
Best Answer
The syntax you're looking for is here
Also check out this page and this link from it specifically about case insensitive searches and collations on columns.
The good news is that you can set it both by database and column.
Also, check this out - you can also use "shadow" columns if you can't get exactly what you want "out of the box" - i.e. UPPER() function.