Executing SQL Commands in the SQL Editor Window
- 更新时间2025-07-23
- 阅读时长2分钟
Database Viewer supports performing multiple delimited SQL commands in a single operation. The SQL commands you enter are split into multiple commands based on the command delimiter used, and these commands are executed sequentially. The Output Tab is updated with the results of all the commands in the batch.
The various databases management systems supported by TestStand use different delimiters for SQL commands. To maintain compatibility with all of these systems, Database Viewer supports the following command delimiters for databases:
- Access— ~
- MySQL and Sybase— ;
- Oracle— /
- SQL Server— GO
Use each command delimiter on a new line. You should also add a new line after the delimiter and before the subsequent commands.
You can use any of the command delimiters mentioned above for execution of multiple commands from Database Viewer. Refer to the following example of delimited SQL commands entered using the ; command delimiter for MySQL and Sybase:
CREATE TABLE PROP_BINARY ( ID CHAR (38) PRIMARY KEY, PROP_RESULT CHAR (38) NOT NULL, UPPER_BOUNDS VARCHAR (32), LOWER_BOUNDS VARCHAR (32), DATA_FORMAT VARCHAR (32), DATA MEDIUMBLOB, CONSTRAINT PROP_BINARY_FK FOREIGN KEY (PROP_RESULT) REFERENCES PROP_RESULT (ID) ) ; CREATE TABLE PROP_NUMERICLIMIT ( ID CHAR (38) PRIMARY KEY, PROP_RESULT CHAR (38) NOT NULL, COMP_OPERATOR VARCHAR (32), HIGH_LIMIT DOUBLE, LOW_LIMIT DOUBLE, UNITS VARCHAR (255), STATUS VARCHAR (255), CONSTRAINT PROP_NUMERICLIMIT_FK FOREIGN KEY (PROP_RESULT) REFERENCES PROP_RESULT (ID) ) ;
The following individual SQL commands are identified and executed sequentially:
CREATE TABLE PROP_BINARY ( ID CHAR (38) PRIMARY KEY, PROP_RESULT CHAR (38) NOT NULL, UPPER_BOUNDS VARCHAR (32), LOWER_BOUNDS VARCHAR (32), DATA_FORMAT VARCHAR (32), DATA MEDIUMBLOB, CONSTRAINT PROP_BINARY_FK FOREIGN KEY (PROP_RESULT) REFERENCES PROP_RESULT (ID) )
and
CREATE TABLE PROP_NUMERICLIMIT ( ID CHAR (38) PRIMARY KEY, PROP_RESULT CHAR (38) NOT NULL, COMP_OPERATOR VARCHAR (32), HIGH_LIMIT DOUBLE, LOW_LIMIT DOUBLE, UNITS VARCHAR (255), STATUS VARCHAR (255), CONSTRAINT PROP_NUMERICLIMIT_FK FOREIGN KEY (PROP_RESULT) REFERENCES PROP_RESULT (ID) ) ;
The SQL commands you enter can also contain comments. For single line comments, use the following syntax:
- Access, Oracle and SQL Server— #<comment text><new line>
- MySQL— --<comment text><new line>
- Sybase— //<comment text><new line>
For multi-line comments, use the following syntax:
/*<comment text>