SQL Link Condition dialog box

Use this dialog box to create or modify a SQL condition in a query.

A SQL condition searches for objects based on data in an external database. (Use the Map Database commands to link external data to objects.)

To create a SQL condition, specify the link template. Specify the column to check and the value for the column.

Build a SQL condition using this dialog box, or type a condition by choosing Type It.

Current SQL Condition area (SQL Link Condition)

This area displays the current SQL condition. You can add, delete, or edit any line in the condition.

Current SQL Condition list

View the current SQL condition.

If lines in the condition have been grouped, the group is indented. (Lines in a group are evaluated before lines outside the group.)

Edit

Copy the selected line to the Condition section so you can edit it.

Group

Group the selected lines.

Select the first and last lines that you want in the group. Click Group.

When you run the query, lines inside the group are evaluated before the rest of the condition.

Ungroup

Delete the parentheses from the selected line and from the matching ending or beginning line of the group.

Delete

Remove the selected line from the condition.

Clear All

Remove all lines from the current SQL condition.

Condition area (SQL Link Condition)

Edit an existing line in the condition or add new lines.

To edit an existing line, select the line in the Current SQL Condition list. Edit the information in the Condition area. Click Update.

To add a new line, select the operator (And/Or/Not). Select a column and an operator and specify a value. Click Add Condition.

And/Or/Not options

Determine how the condition is combined with other conditions.

And specifies that both conditions must be met for the object to be included in the query.

Or specifies that either condition can be met for the object to be included in the query.

And Not specifies that the first condition must be met and the second condition must not be met for the object to be included in the query.

Or Not specifies that either the first conditions can be met or the second condition cannot be met for the object to be included in the query.

Column list

Select a column from the list.

The list displays columns from the current table.

Operator list

Select an operator from the list.

Operator Description
= The value of the selected property or data is equal to the value you enter in the Value box.
> The value of the selected property or data is greater than the value you enter in the Value box.
>= The value of the selected property or data is greater than or equal to the value you enter in the Value box.
< The value of the selected property or data is less than the value you enter in the Value box.
<= The value of the selected property or data is less than or equal to the value you enter in the Value box.
<> The value of the selected property or data is not equal to the value you enter in the Value box.
IN The value of the selected property or data matches any of the values you enter in the Value box. When you use the IN operator, you must enclose each value in single quotation marks, separate the values with commas, and enclose the entire list in parentheses, for example, ('1','2','3').
IS NULL The value of the selected property or data is empty. Do not enter a value in the Value box.
LIKE The value of the selected property or data contains the value you enter in the Value box. Applies to string (character) data types only. Use the percent sign (%) as a wild-card character. For example, to retrieve all objects that have a value starting with B, choose the LIKE operator and enter B% in the Value box. For information on the wild-card characters supported by your database system, refer to the documentation for your database system software.
Value box

Specify the value to search for.

The value must match the data type of the column.

If the string contains a single quotation mark, precede the single quotation mark with another single quotation mark.

For dates, use the format TIMESTAMP'YYYY-MM-DD 00:00:00', for example, TIMESTAMP'1993-06-20 11:24:00'.

To use wild-card characters with string values, use the LIKE operator. For example, to retrieve all objects that have a value starting with B, choose the LIKE operator and enter B%. Refer to the documentation for your database software to see which wild-card characters are supported.

Add Condition

Add the condition line to the Current SQL Condition list.

The new line is added to the bottom of the list. If any line in the list is selected, the new line is added above it.

Update

Update the selected condition in the Current SQL Condition list.

Other Controls

Link template list

Select the link template that specifies the table containing the data to use for this query condition.

This list displays only the link templates available in the source(s) you are querying. For example, if you are querying source (attached) drawings, the list will display only the link templates in your source drawings. If you are querying the current drawing, the list will display only the link templates in the current drawing.

You can query only one link template in a SQL condition. To query a different link template, create a new SQL condition.

History

Display the SQL Condition History dialog box, where you select from a list of SQL conditions you previously added.

Type It

Display the Type SQL Condition dialog box, where you enter your SQL condition.