Partager via


CREATE QUERY Command

Opens the Query designer.

CREATE QUERY [FileName | ?] [NOWAIT]

Parameters

  • FileName
    Specifies the file name for the query. If you don't specify an extension for the file name, Visual FoxPro automatically assigns a .qpr extension.

  • ?
    Displays the Create dialog box that prompts you to name the query being created.

  • NOWAIT
    Continues program execution after the Query Designer is opened. The program doesn't wait for the Query Designer to be closed, but continues execution on the program line immediately following the line that contains CREATE QUERY NOWAIT. If you omit NOWAIT when CREATE QUERY is issued in a program, the Query Designer is opened and program execution pauses until the Query Designer is closed.

    NOWAIT is effective only from within a program. It has no effect on CREATE QUERY when issued from the Command window.

Remarks

CREATE QUERY opens the Query designer so you can interactively create a query.

A SQL SELECT command is used to retrieve data from tables. SELECT is very powerful and can replace a series of Visual FoxPro commands. Because one SQL SELECT performs the function of a series of Visual FoxPro commands, SELECT optimizes program performance.

Think of SELECT as a way to pose a query to Visual FoxPro to obtain information from tables. SELECT allows you to specify the information you want without telling Visual FoxPro how to retrieve the information. Visual FoxPro determines the best way to retrieve the information.

After you create a query, the query is stored as a Visual FoxPro program file with a .qpr extension. A query program can be executed with DO. You must include the query file extension when executing a query with DO, as shown in the following example.

DO my_query.qpr

Issuing the command CREATE QUERY without any additional arguments opens a new query window. The name QUERY1 is assigned to the query. When you exit the Query window, you can save the query with a different name.

See Also

Reference

MODIFY QUERY Command

SELECT - SQL Command

Other Resources

Query and View Designers

Commands (Visual FoxPro)

Language Reference (Visual FoxPro)