Show All
Run, view, or edit an SQL command, procedure, or statement
If you know Structured Query Language (SQL), you can use SQL to edit a query's SQL SELECT statement. For more information about SQL, see the documentation for your database.
- Create a new query. Do not return the results to Microsoft Excel.
How?
- Click View SQL
.
Microsoft Query displays the SQL dialog box with the SQL SELECT statement that corresponds to the query.
- Type any changes you want to make into the SQL statement, and then click OK.
To add a new line in the SQL statement box, press ENTER.
Notes
- To change or replace the SQL statement, use the same SQL syntax that Microsoft Query uses or the syntax your data source supports. Microsoft Query tries to interpret the syntax you use and displays both the query's design and its result set.
- If Microsoft Query can't display the query's design because it can't interpret a portion of the syntax you used, the result set is still displayed. However, you can change only the result set's formatting, such as the display font or column width. You can't edit data, and you must make any change to the query definition, such as adding or removing fields, in the SQL dialog box.