Create a query (.qry) file to add a SQL statement operation to a database service. A query file contains Select statements created by the SQL Query Editor and can be reused for other database services at any time.
To create a query file:
Create a query file. Do the following:
From the main menu bar, select File|New|Other.
The Select a wizard dialog appears.
Select Sybase|Query, and click Next.
The Create Query File dialog appears.
Specify the name and location of the query file. Do the following:
Select the project to contain the query file.
Name the file.
Select a database connection profile for the query file. Choose from the following:
Click Connect to connect to the database.
If no connection profile is appropriate for the query file, click New Connection Profile to create a new one.
Click Finish to create the file.
The SQL Query editor opens displaying a list of database tables.
Create more complex SQL statements by adding and nesting clauses. Do the following:
Select the query file you want to include nesting and click Open With|SQL Query editor in the context menu.
Define the table layout. Select the columns in the list that you want to use in your table and specify the following clauses:
Available Clauses in Visual SQL
Clause | Description |
---|---|
Where | Specify the rows to be affected by a select statement. Choose from the following:
|
Compute | Define additional result columns using expressions. If used with a group clause, these expressions may calculate a Summary value. |
Sort | Sort queries by column in ascending or descending order. |
Group | Organize groups based on repeating values in the grouping columns. Drag and drop groups from the left pane to the right pane. |
Having | Specify which groups to display based on the group clause. Rows that do not meet the search conditions of that clause are excluded |
XML | Currently not supported. |
(Optional) Preview the query and retrieval arguments:
Preview the query. Click inside the SQL editor and select Design|Preview from the main menu bar.
Add the retrieval arguments:
Click inside the SQL editor and select Design|Retrieval Arguments from the main menu bar to open the Specify Retrieval Arguments dialog.
Enter the argument name, select an argument type from the drop-down list, and click OK.
The argument is now available for use.
See Specifying Retrieval Arguments in a Query File for more information.
Save the query file. Select File|Save from the main menu bar.
Send your feedback on this help topic to Sybase Tech Pubs: pubs@sybase.com