Lesson 2.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 managing large numbers of statements.

About this task

In this lesson, you will create your own script file. The script can contain one or more SQL statements or commands.

Procedure

  1. From the Linux® command line in the cluster that contains the Db2® Big SQL server, log in as the bigsql user, and provide the password if prompted.
    su - bigsql
  2. Use any available editor (for example, vi) to create a new file named aFirstFile.sql in your local directory.
    vi aFirstFile.sql
  3. Add the following comments in the aFirstFile.sql file:
    
    --This is a simple SQL script.
    --These are comments. Any line that begins with two dashes is a comment line
    --  and is not processed as an SQL statement.
  4. Save the aFirstFile.sql file in the /home/bigsql directory.
    
    [bigsql@<node1> ~]$ ls
    aFirstFile.sql  hosts  logs  sqllib