Managing the repository > SA Encyclopedia Manager (SAEM) > SAEM menus > Query menu
  
Query menu
Opening the query workspace
You can build queries using commands from the Query menu choice, or open a Query workspace, so that you can access the commands more easily.
To open the Query Workspace
From the Workspace menu, select Query. The Query Workspace will be displayed along the right frame of the SAEM border.
New query
Opens the New Query window. To type a new query, paste one from the clipboard, or load a saved query use the My Queries tab. Queries are also loaded onto the New Query window by Query Builder. When loaded, you can check your query, save it to a file, or execute it, among other options.
See also Create query.
Open
Opens an existing SQL query file, which is saved with the .SQL file name extension. You can open more than one query file simultaneously.
Close
Closes the query currently in focus. If you created a new query and did not save it before selecting Close, you will be prompted to save your query file, which you save with an *.SQL file name extension.
Save
Save the open query file. You will be prompted to save your query file when you choose to close it. You can tell whether you've saved your query by looking at its name in the query window, which displays unsaved queries with an asterisk next to their names. For example, an unsaved query would appear as "New Query*", while the same query, saved, would appear as "New Query". Query files are saved with .SQL file name extension, and you can run a single file in multiple databases.
Save as
Save the open query file with a different file name. You will be prompted to save your query file when you choose to close it. You can tell whether you've saved your query by looking at its name in the query window, which displays unsaved queries with an asterisk next to their names. For example, an unsaved query would appear as "New Query*", while the same query, saved, would appear as "New Query". Query files are saved with .SQL file name extension, and you can run a single file in multiple databases.
Save results
You can save query results as a MS Excel (*.XLS), a Comma Delimited Value (*.CSV) file or a text (*.TXT) file.
Print
Print contents of the currently selected SAEM window. To print your query results, click Query and select Print Results.
Print results
You can print the Data output to a printer of file.
Parse
Checks query syntax. If the query is syntactically correct the Messages window returns The command(s) completed successfully. If it is not, it returns the line number with the incorrect syntax and tells you which character the error is near.
Execute
Executes the query and returns the output in the Data tab. You can drag a column header into Data tab' gray area on top to group the output by that column.
Estimated execution plan
SQL Server has a built-in optimizer that evaluates the quickest way to build a query result set. Running the Estimated Execution Plan reveals, in the Results window, the internal syntax that the SQL Server will use to execute your query. The data is mostly informational and is useful if you understand costing models and data-access algorithms.
Filter
You can filter queries using commands from the Filter menu choice, or open a Filter toolbar, so that you can access the commands more easily.
To open the Filter toolbar
1 Right-mouse click on the SAEM toolbar.
2 In the popup filter, notice that Filter is one of the choices. If it does not have a check mark next to it, the Filter toolbar is not being displayed.
3 Select Filter to open the Filter toolbar. It will display along the right frame of the SAEM border.
See also
SAEM menus