Skip to Content

SQL Anywhere, on-demand edition Running SQL Statements

Module 13 - Running SQL Statements

In this module, you will learn how to execute SQL on databases in the cloud. SQL statements can be executed on either single databases or groups of databases. Databases where SQL statements will be executed can be chosen individually or by their tags.

Pre-requisites

Your cloud should have the basic architecture set up with at least a few tenant databases running.

Running SQL Statements on Databases

To run generic SQL statements on your tenant databases, you can run the ExecuteTenantBatch task from the Cloud Console. This task allows you to select multiple databases to execute statements on batches of databases.

Note: You can also use the SQL Anywhere administration tools to execute SQL. This will be discussed in a later module.

To use the ExecuteTenantBatch task:

  1. In the Cloud Console, click Events in the left hand navigation pane and click Run new Task. Select the ExecuteTenantBatch task. Click Next.
  2. In the parameters for the task, select the databases on which you want to execute SQLstatements. Select multiple databases by holding down the Ctrl key on your keyboard while clicking the databases. Alternatively, you can select your databases using tags. For information on how to use tags to specify objects when running tasks, refer to the search syntax documentation at http://dcx.sybase.com/index.html#cloud100/en/dbcloud/cloud-searches.html.
  3. In the sql_batch field, type the SQL statements you want to run. In this example, a new row with an ID 4852 is added to the table Contacts. Click Finish to run the task.                                      
Tags:

No comments