Query Builder

Use the Query Builder dialog box to create a query for use in the Execute SQL task, the OLE DB source and the OLE DB destination, and the Lookup transformation.

The graphical tools in the Query Builder dialog box let you construct queries using drag-and-drop operations. By default, the Query Builder dialog box constructs SELECT queries, but you can also build INSERT, UPDATE, or DELETE queries. All types of SQL statements can be parsed and run in the Query Builder dialog box.

To learn more about the Transact-SQL language and its syntax, see Transact-SQL Reference (Transact-SQL).

You can also use variables in a query to provide values to an input parameter, to capture values of output parameters, and to store return codes. To learn more about using variables in the queries packages use, see Execute SQL Task, OLE DB Source, and Using Queries in Packages.

The Lookup and Fuzzy lookup transformations can also use variables with parameters and return codes. The information about the OLE DB source applies to these two transformations also.

Options

  • Toolbar
    Use the toolbar to manage datasets, select panes to display, and control query functions.

    Value Description

    Show/Hide Diagram Pane

    Shows or hides the Diagram pane.

    Show/Hide Grid Pane

    Shows or hides the Grid pane.

    Show/Hide SQL Pane

    Shows or hides the SQL pane.

    Show/Hide Results Pane

    Shows or hides the Results pane.

    Run

    Runs the query. Results are displayed in the result pane.

    Verify SQL

    Verifies that the SQL statement is valid.

    Sort Ascending

    Sorts output rows on the selected column in the grid pane, in ascending order.

    Sort Descending

    Sorts output rows on the selected column in the grid pane, in descending order.

    Remove Filter

    Select a column name in the grid pane, and then click Remove Filter to remove sort criteria for the column.

    Use Group By

    Adds GROUP BY functionality to the query.

    Add Table

    Adds a new table to the query.

  • Query Definition
    The query definition provides a toolbar and panes in which to define and test the query.

    Pane Description

    Diagram pane

    Displays the query in a diagram. The diagram shows the tables included in the query, and how they are joined. Select or clear the check box next to a column in a table to add or remove it from the query output.

    When you add tables to the query, Query Builder creates joins between tables based on tables, depending on the keys in the table. To add a join, drag a field from one table onto a field in another table. To manage a join, right-click the join, and then select a menu option.

    Right-click the Diagram pane to add or remove tables, select all the tables, and show or hide panes.

    Grid pane

    Displays the query in a grid. You can use this pane to add to and remove columns from the query and change the settings for each column.

    SQL pane

    Displays the query as SQL text. Changes made in the Diagram pane and the Grid pane will appear here, and changes made here will appear in the Diagram pane and the Grid pane.

    Results pane

    Displays the results of the query when you click Run on the toolbar.

See Also

Reference

Other UI Reference

Other Resources

Execute SQL Task
OLE DB Source
OLE DB Destination
Lookup Transformation

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

14 April 2006

New content:
  • Added information about using variables with parameters.
  • Added tip about building INSERT, UPDATE, or DELETE queries in the Query Builder.