Lesson 1.1: Creating an SQL script file

The SQL script file is a container for SQL statements or commands. When you run SQL statements from a client such as JSqsh, the script file is a convenient way of manipulating large numbers of statements.

About this task

You already know how to run the predefined SQL scripts from the tasks to set up your environment. In this lesson, you will create your own script.

The script file can contain one or more SQL statements or commands. Within IBM® Big SQL in the JSqsh client, you can run an entire file.

Procedure

  1. Log into the bigsql user account and type the appropriate password when prompted.
    su bigsql
  2. From the Linux command line, use any available editor to create a new file in your local directory named aFirstFile.sql. Make sure that bigsql has read, write, and execute authority for the directory. For example, type the following command:
    vi aFirstFile.sql
    For the purposes of this tutorial, the file will be saved in the /home/bigsql directory.
  3. Add the following comments in the aFirstFile.sql file:
    --This is a beginning SQL script
    --These are comments. Any line that begins with two 
    --  dashes is a comment line,
    --  and is not part of the processed SQL statements.
  4. Save the aFirstFile.sql file.