Previous Topic: Validation Rule PropertiesNext Topic: View Properties


Add a SQL Azure Validation Rule

Add validation rules to your SQL Azure data model to enforce the business rules of your organization. The rules that you create can establish a value, a list of values, or a range of acceptable values to store in a table, column, entity, or attribute.

To add a validation rule

  1. Click Validation Rules on the Model menu.

    The SQL Azure Validation Rule Editor opens.

  2. Click the New New icon in property editors to create a new object button on the toolbar.

    A new validation rule with a default name is added to the Navigation Grid.

  3. Work with the following options:
    Physical Name

    Specifies the physical name of the validation rule. You can change the name in this field.

    Type

    Specifies the validation rule type. You can select one of the following options:

    User-Defined

    Specifies to use an expression to create a server-side validation expression. This expression is entered in the General tab.

    MinMax

    Specifies to use minimum and maximum values. The values are specified in the General tab.

    Valid Values

    Specifies to create a set of valid values. The values are specified in the General tab.

    Physical Only

    Specifies that the validation rule only applies to a physical model.

  4. Click the General tab and work with the following options. The options available are based on the options you selected in the Type drop-down in the Navigation Grid.
    User-Defined Validation Rule Type Option
    Expression

    Lets you enter an expression in the correct syntax for the selected server to create a server-side validation expression.

    MinMax Validation Rule Type Options
    Quote Value

    Specifies whether to automatically enclose each value in a list of valid values in a single quotation mark. Use the drop-down to specify Yes or No.

    Invert Expression

    Specifies whether to invert the expression. Inverting an expression includes the word NOT in the expression. Select the check box to enable this option. For example, if the expression is BETWEEN 5 AND 10, and you select the check box, the expression is changed to NOT BETWEEN 5 AND 10.

    Min

    Lets you enter a minimum value.

    Max

    Lets you enter a maximum value.

    Expression

    Displays the expression in the correct syntax using the properties you specified, to create a server-side validation expression.

    Valid Values Validation Rule Type Options
    Quote Value

    Specifies whether to automatically enclose each value in a list of valid values in a single quotation mark. Use the drop-down to specify Yes or No.

    Invert Expression

    Specifies whether to invert the expression. Inverting an expression includes the word NOT in the expression. Select the check box to enable this option. For example, if the expression is BETWEEN 5 AND 10, and you select the check box, the expression is changed to NOT BETWEEN 5 AND 10.

    Valid Values

    Identifies the valid values. In addition to sorting, creating, deleting and reordering valid values, you can use the toolbar to import valid values.

    Expression

    Displays the expression in the correct syntax using the properties you specified, to create a server-side validation expression.

  5. Click Close.

    The validation rule is added and the SQL Azure Validation Rule Editor closes.

More information:

Validation Rule Properties

Create a Valid Value List

Copy Valid Values from a Validation Rule

Delete a Valid Value

Assign Validation Rule UDP Values

Define Validation Rule Usage for a SQL Azure Table