This article describes how to manage executed queries, search its content and re-use them, using the Executed queries feature.
To enable the Query history feature, check the Log run queries option:
Once the feature is enabled, the information about the executed queries can be accessed through the Query history window, which can be initiated from the ApexSQL Complete menu and a click on the Query history command from the drop-down list:
This will open the Query history window:
The Query history window show the information about the date and time of the execution, status of the query (Successful, Completed with errors, and Failed), the user who executed a query, database against the query was executed and the duration of the execution. Each of these segments can be used as a grouping criterion. Dragging the header of the column and drop it in the area above the list of executed queries, the list will be grouped:
Searching the run queries
The content of the run queries can be searched through the search box at the top of the window. Specifying the search hint and searching through the run queries will show a list of all queries that contain specified term, and in the query content preview, searched term will be highlighted:
Re-using run queries
Content of each query from the Query history window can be copied and re-used. With a double-click on the query from the list, it will automatically put the query content in a new query window:
Q: Can I browse the run queries even if the Query history feature is disabled?
A: Yes. All run queries are accessible from the Query history window, no matter if the feature is enabled or disabled.
Q: Will the run queries information will be deleted when the Query history feature is disabled?
A: No. Already logged run queries will not be deleted, but all queries executed after disabling the feature won’t be logged.
Q: Will the installation or upgrade of ApexSQL Complete delete the information about run queries?
A: No. The uninstallation or upgrade to a newer version does not affect saved information about executed queries, unless they are manually removed or edited.
Q: Where the information about run queries is stored?
A: By default, the information about run queries is stored in the following location:
Q: What is the way the information about run queries is stored?
A: The information about run queries is stored in a way that a separate folder is created based on date (i.e. 07-11-2015). Each folder contains an xml file where the information about all run queries for the specified date is stored.
Q: Can I edit the information about the run queries outside the host application (SQL Server Management Studio or Visual Studio)?
A: Yes. XML files that keep store the information about executed queries can be edited. However, this is not recommended, since there is a possibility to break the structure of the XML file and it won’t be loaded in the Query history window, or it won’t show the information properly.
Q: What is the minimum date that can be set in the “From” date filter?
A: This can be set in the Query history tab, under the Options window by changing the Default period option:
Q: If I run the same query multiple times, will this be shown as a separate execution, or the newer execution overwrites an older one?
A: Each execution will be saved as a separate event, since ApexSQL Complete logs run queries by the time of the execution regardless of a query content.
Q: Can I use the information about run queries on another machine?
A: Yes, just copy the Executed queries folder and paste it to the corresponding folder on another machine. After the host application is started, all information will be accessible through the Query history window.