Export (0) Print
Expand All

SQL Expressions

Visual Studio 2005

SQL expressions are like formulas, but they are written in Structured Query Language (SQL). An SQL expression can be used to query the database for specific sets of data. You can sort, group, and select based on SQL expression fields.

SQL expressions are useful in optimizing report performance because the tasks they execute are normally performed on the database server (as opposed to a regular formula, which is sometimes executed on the local machine).

Don't use SQL expressions exclusively, because Crystal Reports includes its own formula language, which is much more powerful than standard SQL. Both Crystal Syntax and Basic Syntax allow you to enhance and hone your formulas in ways that are either difficult or impossible with SQL. In certain circumstances, however, creating and using SQL Expression fields can speed up the processing of your reports.

To create an SQL Expression field

  1. In the Field Explorer, right-click SQL Expression Fields and click New.
    Note   When an SQL/ODBC data source is used to design a report, the program adds SQL Expressions Fields to the Field Explorer.
  2. Enter a name in the Name box, and then click OK.

    The SQL Expression Editor appears. The SQL Expression Editor functions in the same way as the Formula Editor.

  3. Type the expression in the SQL Expression Editor.
  4. Click the Save and close button.

See Also

Formula Editor | Optimizing Report Performance

Show:
© 2015 Microsoft