Run scripts

You can use scripts to bundle all your queries into a single file, which you can then run automatically and repeatedly. You can create a script by using any standard editor and typing regular SQL commands.

There are three ways that you can run scripts:
  • You can use the redirect command on the command line to specify that the system use a file instead of stdin:
       nzsql < script_file
  • You can use the nzsql command-line argument -f, which you can use to specify a file:
       nzsql -f script_file
  • You can specify the script from within the nzsql command interpreter:
       EMP.SCHEMA(USER)=> \i script_file