ssasql can operate in SQL mode or in Session (SESS)mode. Each mode has its own set of commands. Additionally, there is a set of system-level commands. Session mode enables users to connect and disconnect database sessions. SQL mode enables users to execute SQL statements interactively against a database. The system-level commands include commands for switching between the operating modes.
The ssasql prompt always reflects the mode currently in use. When in Session mode, ssasql displays a prompt of the form
SESS:
n
>
; when in SQL mode, the prompt is
SQL:
n
>
(where
n
is a number reflecting the command number for each mode). Each time a command is issued within a particular mode, the command number displayed in the prompt increases by one.
When the ssasql invocation connects to the database successfully, the user is automatically placed in SQL mode. If the ssasql invocation does not connect successfully, either because the invocation arguments are invalid or are not included, the user is automatically placed in Session (SESS) mode.
The standard redirection character (
<
) may be used in conjunction with the ssasql invocation to execute SQL commands contained in a batch file, as in the following example:
ssasql server1_vip dba <batch.sql
This ssasql invocation connects to a Data Vault repository database or Nucleus database instance called
vip
, using the connection
server1_vip
, as the user DBA. The SQL statements contained in the ASCII file
batch.sql
are executed automatically. To return control to the operating system shell when command execution is finished, include the