SQL Prompt 10

SQL History

SQL History is a new feature that was released in SQL Prompt v10.13. Versions older than this contain the previous Tab History feature. See here for help with Tab History.

SQL History is supported in SQL Server Management Studio only.

SQL History helps you to keep track of the queries that you use in SQL Server Management Studio, plus the history of those queries.

As you type SQL in a query window SQL History will record what you are doing, allowing you to browse and search through the history of your work.

If you close a query without saving, you can reopen it from SQL History and the code will be as it was before you closed it. If you close SSMS without saving tabs, or SSMS crashes, SQL Prompt will automatically restore all queries that were open prior to the shutdown/crash, with their contents in the state when the last of the above actions occurred.

Browsing SQL History

To browse your SQL history, click SQL History on the SQL Server Management Studio toolbar:

The SQL History window is displayed in a new tab. Just like normal tabs, this can be moved and anchored according to your preference.

The SQL History window shows the following information about each query:

  • the file name

  • the server and database the query was connected to
  • the time the query was last updated
  • the history of the selected query with timestamps for each version
  • the contents of the query (SQL code)

Searching 

You can search your entire query history. For more information, see here.

Actions on a query

There are several actions that can be performed on a query:

  • Opening/closing - open/close the current query.
  • Starring - set the current query as a favorite.
  • Renaming - renames the current query. You can't rename queries that are currently open.
  • Removing - remove the query and its associated history.
  • Removing older than - remove all queries older than the current query, including their associated histories.

Starring a query can be done by clicking on the star icon next to its name. For the other actions, hover over a query and click the three dots to bring up the menu:

Starred Queries

Starring a query marks is as a favorite, making it easier to find it later. To star/unstar a query, click the star icon next to its name.

To view starred queries, click the star button above the list of queries.

Restoring open queries

When you start Management Studio, SQL Prompt automatically restores open queries from your previous session.

If you don't want SQL Prompt to do this, it can be disabled in the SQL Prompt options:

Auto-trimming

Historical versions of queries are trimmed periodically to improve performance and take up less space. This happens automatically in the background.

Auto-trimming will not remove query executions from the history.




Didn't find what you were looking for?