isql is a command-line sql interface. It allows you to enter any sql command - Connect, Create, Select, Insert, and the like - or to run a script containing those commands.

The version that comes with Firebird 1.5 understands dialects.

This program

Running isql via Windows Explorer | Comments Problems - Extra /* Failure Mixing Comment Types
isql Commands | Debugging Scripts - Registry Mods

Running isql via Windows Explorer

The simplest way to run isql (IMHO) is to To make this work, I had to modify the registry

This is a possible *.reg file - on some systems, the .sql key may already exist.

Notice that If you do it manually, enter this


There are 2 methods to enter comments

However, there are several problems with the version of isql (dated 7-14-04) that come with Firebird 1.5.

Extra /*

This problem applies to - isql 7-14-04. Using the /* ... */ syntax to add comments, this example fails. The issue is related to the number of characters between the delimiters and to the fact that the last line of the comment is /* */. with this error

If the comment is shortened to remove the last line of the error message and everything after it, the code does not fail.

Also, if the last line of the comment is changed from


(ie, place a return between the 2 asterisks) there is no failure.

Failure Mixing Comment Types

If a block comment is immediately followed be a single line double dash (--) comment that ends with a semicolon (;), the script fails. produces this error However, both of these run without error

The semicolon (;) at the end of the single line comment is removed

An sql statement is placed between the two types of comments In addition, you can not place single line (--) comments inside block comments.

isql Commands

In isql you can enter normal sql commands, terminated by a semicolon.

Several other "special" commands are supported

If you enter a command without a terminator (semicolon), the prompt changes from sql> to con> (continuation). This allows you to type commands on several lines - to return to normal mode, enter the current terminator and press enter.

Debugging Scripts

Using isql, it is a challenge to debug scripts - this should help.

When running a script, it is likely that an error will be displayed ... but the command that caused the error will not be displayed.

There are 2 ways to display where the error is

will display all the commands as they are executed. Use (the default) to hide them again.

You can also use a select statement to write a comment to the screen


Registry Mods

These are several registry modifications that will simplify debug. Only the commands are discussed below - a reg file is provided to modify your registry. Please view and verify the content before merging the data ... fixing any paths as appropriate. (For instance, isql may be in a different directory on your system.) Note - if your system already has commands associated with *.sql files, this *.reg file will ignore and replace them. Please check first. In one version, the code simply executes the sql file and displays the errors (if any). This simplifies checking for errors. The other version displays the sql text and associated errors - this simplifies debug.

For simple problems, I prefer to display the errors in the command window ... but for more complex errors, or large files where I want to search for the errors, then notepad is more convenient.

Reference - A Quick Guide to ISQL's Switches and Commands for Firebird/InterBase

Registry Mods for *.fdb files

This registry modification (associated with *.fdb & *.gdb files) will display the sql necessary to recreate a database - including the tables, triggers, generators, and the like. Notice that this requires a username and password - I have included defaults, yours should be different. This command (actually entered on a single line, wrapped for readability) produces a file that contains the sql statements and then opens that file in notepad. Notice that cmd supports multiple commands separated by Because isql actually appends the data to an existing file, the command string starts with a file delete. The first time this is run, the delete command produces a "File not found" error. The only problem I have with this technique is that an empty command window is displayed until notepad closes.

Author: Robert Clemenzi -
URL: http:// / user / clemenzi / technical / Databases / Firebird / isql.html