InterBase Quick Start: Part II - Running an SQL Script

From InterBase

Go Up to InterBase Quick Start: Part II - Data Definition

Data Definition Files

A data definition file (also called SQL script) is a text file that contains SQL statements. You can execute it in the Interactive SQL window of the IBConsole. To create, open or modify data definition files, you can use a text editor such as Notepad.

It is often convenient to create a data definition file rather than typing each statement, because the text editor provides you with an editing environment and the script provides a reusable record of what was entered. In practice, most data definition is done using data definition files.

The CONNECT Statement

Every SQL script must begin with a CONNECT statement. The CONNECT statement specifies a complete path to the database, a user name, and a password. However, if you connect to a database beforehand, you may omit the CONNECT statement when executing an SQL script in the Interactive SQL window.

If you do specify a connect statement, make sure to modify the values accordingly. The SQL scripts that accompany this tutorial begin with the following CONNECT statement:

CONNECT 'C:\ProgramData\Embarcadero\InterBase\gds_db\examples\database\TUTORIAL.IB'

Before executing a script with the above CONNECT statement, do one of the following:

  • Comment-out the statement (see Comment for more information).
  • Modify the path.

Image 025.jpg Run the DOMAINS.SQL Script

  1. Download the InterBase Quick Start Scripts, ZIP file to your computer. The scripts folder contains a set SQL script files and a Readme file that explains how to use the scripts on a UNIX system.
  2. Load the DOMAINS.SQL script.
  3. Execute the query.
  4. To confirm that the domains now exist, click on Domains item in the left pane of IBConsole. You should see the following domains:

Advance To

Creating Tables