SQL Task: “When Data Not Found” Field
View some of the Frequently Asked Questions to our support staff. Included are some tips and tricks making this forum ideal for users getting started with GoAnywhere MFT. Note: Users can reply to existing topics but only our support staff can add new topics to this forum.
1 post
Page 1 of 1
- Support Specialist
- Posts: 9
- Joined: Mon Jul 22, 2019 11:32 am
Question: What is the correct way of utilizing the “When No Data Found” field in the SQL Task?
Answer: The SQL Task can connect to a database server for running SQL statements, which is useful for retrieving rows (records) from tables (physical files) or performing updates, inserts, etc. The database server connections can be pre-defined as reusable Resources, which can be selected from a drop-down menu in the SQL Task.
The Query Element of a SQL Task allows you to specify a SQL Statement that will execute on your SQL server. The required element for the Query Element is the SQL Statement to be executed. Any valid SQL statement that is supported by the target database server is allowed. Some example statement types include – SELECT, INSERT, UPDATE, DELETE, CALL, CREATE, etc. An easy to use graphical tool is provided to build SELECT statements. Click on the ‘..’ button to launch the SQL Wizard.
Note: Not all databases support closing semi-colons and, as a result, may return an invalid character error.
The “When No Data Found” field is in the Advanced Panel of the Query Element. Here, you specify the action to take when the query produces an empty RowSet.
![Image](https://lh3.googleusercontent.com/Tvi06NW4RvXphyObI5m_g6ahOsGJObonBk8J6ofqxJyU_1LRAJj3XE9zOVtabTfI1XyQqO44qv2KhnR6z5t00FaSKHjx-ycwpytEei1i48T2VMAfgWFTvLIo26rDpmdB6Mx2YHzk22fgDzyiYuOlkt9-pkUGzm6WnMR0af0sMxvsx9uGKE-snogsoxyW-ZgTFv9b8slvkYz-FWGQnHveakhBdu0B3mBU9rxyIF_v0_MfWMez6IKsT1L29HVnSi-E5H4xVOflE8rxJaFd79L23n4F_0YCw2MG0OaHuvYQyqLu5rUr-depiNv4ETqLw2vifQCrD4rt_lYHzy5pUPFtb_dv0WJUg3EPJj65Tek7aIPLxcP_NC5ein8jZeUn3xpgyQaJs0RTy99rMOv6Q5HplEbmZQTHGBMg-JWSg0Uspy5l1_v8XbZZl6yUHgaFG7_CO1tLgQIZu6V29Zp9Vhg--2MZ8d5uwL256YW26PQtO8Wl_BJh-zDPUI5X41-8oy8klbHrljS5b2kkXT1X-tNpXV7uEhDEMt0CiPtPAiwgeT5zBxSeyAA4HfnBicfznangzTJqVbCyZkUydycI0j5RfajDS8V7s2Cdo6vmguk7HMb_2dCr-IckUmQRJOyj7uXgV24Wi-B_s-cULZQu5XVNslOjS8ZD0TngErvkaU9JV4FD9uhk75_ujT0JL-Ti=w885-h728-no)
By default, the project will continue with executing the next task. Note that this attribute does not have any effect for SQL statements that DO NOT produce a RowSet such as insert or update statements.
Another option for this field is to throw an error and stop the current execution.
The final option is to create or replace a specified project variable with the specified value and continue on with the next task or module; for example, setVariable:error=true. So, if the query produces an empty RowSet, then this error variable will be given the value of “true”. It is advised to create a variable before making this query so that if there are no empty RowSets, there is still an existing variable to use for the Project.
Answer: The SQL Task can connect to a database server for running SQL statements, which is useful for retrieving rows (records) from tables (physical files) or performing updates, inserts, etc. The database server connections can be pre-defined as reusable Resources, which can be selected from a drop-down menu in the SQL Task.
The Query Element of a SQL Task allows you to specify a SQL Statement that will execute on your SQL server. The required element for the Query Element is the SQL Statement to be executed. Any valid SQL statement that is supported by the target database server is allowed. Some example statement types include – SELECT, INSERT, UPDATE, DELETE, CALL, CREATE, etc. An easy to use graphical tool is provided to build SELECT statements. Click on the ‘..’ button to launch the SQL Wizard.
Note: Not all databases support closing semi-colons and, as a result, may return an invalid character error.
The “When No Data Found” field is in the Advanced Panel of the Query Element. Here, you specify the action to take when the query produces an empty RowSet.
By default, the project will continue with executing the next task. Note that this attribute does not have any effect for SQL statements that DO NOT produce a RowSet such as insert or update statements.
Another option for this field is to throw an error and stop the current execution.
The final option is to create or replace a specified project variable with the specified value and continue on with the next task or module; for example, setVariable:error=true. So, if the query produces an empty RowSet, then this error variable will be given the value of “true”. It is advised to create a variable before making this query so that if there are no empty RowSets, there is still an existing variable to use for the Project.
1 post
Page 1 of 1