Sql
The Sql task (sql
) allows user to execute SQL commands and scripts against a specific database. The SQL script is included in the task XML.
Attribute |
Type |
Purpose |
db |
string |
Database where the SQL script is run |
Example
<job multithread="false">
<sql name="SQL01" db="QS">
drop table xls01;
drop table xls02;
create table xls01 (i1 int, c1 char(80), primary key(i1));
create table xls02 (i1 int, c1 char(80), c2 char(80) primary key(i1));
</sql>
<setenv name="OTHERVAR">ANOTHER USER</setenv>
<sql name="SQL02" db="QS">
insert into xls01 values (1, 'I AM %USERNAME%');
insert into xls01 values (2, 'YOU ARE %FAVAZZA%');
</sql>
</job>
Status codes
Status |
Status code |
Description |
Ready |
-1 |
Task is initialized, but not yet started |
Running |
-2 |
Task is running |
Success |
0 |
Task completed successfully |
Warnings |
1 |
Task completed with warnings |
Errors |
2 |
Task completed with errors |
Aborted |
9 |
Task cannot be executed |