Developer

<sql-command>

The <sql-command> element will execute a SQL command against a database system. This element must be contained by a <sql-connect> element that creates a connection to the database system against which the SQL command will be executed. The <sql-command> element can contain the SQL statement to be executed, or it may reference a text file containing the command or commands to be executed. Results from executing the commands against a database can be logged based on the settings of the containing <sql-connect> element. The <sql-command> element can contain a <sql-expect> element that can verify the return set of any SELECT statement run by the <sql-command> element. Based on the <sql-command> element’s ignoreErrors attribute setting, errors in executing the SQL command can be ignored or not. If errors are not ignored (default behavior) a script error will be thrown in the event an error occurs in executing the SQL statement. The <sql-command> element must either reference a file in its commandFile attribute containing the SQL command(s) to execute, or the text contents of the element itself must include a single SQL command.

Structure

Contains:
  • Text - The SQL command to be executed against the database. Should not be present if a file is referenced in the commandFile attribute.
  • <sql-expect>
Contained By:
  • <sql-connect>
Table 66: Attributes
Name Description Data Type Default Value Required
commandFile This attribute can contain the full path and file name, including file extension, of a plain text file containing the SQL command(s) to be executed against the database. This attribute should not be specified if the contents of the <sql-command> element include the SQL command to be executed. string none No
ignoreErrors This attribute specifies whether or not errors returned when attempting to execute the SQL command should be ignored. This is a Boolean value. When true errors will be ignored. When false errors will not be ignored and a script error will be thrown when an error occurs. Boolean False No
common script attributes This element includes the following common script attributes:
  • timeout
  • sleep
N/A N/A N/A