We've put together The SQL Prompt Functionality Finder to help you navigate your way around SQL Prompt, and which summarizes many of the keyboard shortcuts for the various functions.
Broadly, however, most SQL Prompt features can be accessed from one of three places:
Within a query window, you can right-click at any cursor position to find various navigational and scripting tasks, depending on the exact context of the right click. You can also right-click to create a snippet from a highlighted block of text.
Within object explorer, the context menu provides Tab Management functionality (if a server or database is highlighted), or refactoring functionality (if a database object is highlighted).
Within a results pane, you can highlight values and right-click to include them in scripts, or to open the results in Excel.
Yes, you can install SQL Prompt into Visual Studio only, by unticking the "SQL Prompt for Management Studio" checkbox, when you run the installer. Likewise, you can install only in SSMS by unticking "SQL Prompt for Visual Studio" during installation.
Documentation: Installing and running SQL Prompt
Our policy is to mirror Microsoft's SSMS support cycle in SQL Prompt. This means that new versions of SQL Prompt will support SSMS 2012, 2014, 2016 and 2017, only.
We want to focus on delivering SQL Prompt improvements, and continuing to support older SSMS versions would mean having to develop, test and support two separate products, for a very small minority of users who are unable to upgrade, especially given that SSMS is now a free, standalone tool.
If you are unable to upgrade to a newer version of SSMS you can still use SQL Prompt 7 or earlier.
The Product Learning section of the Redgate Community Hub is full of tutorials and tips to help you get the most out of SQL Prompt. You can also connect with fellow users and share ideas via the forums.
We have a UserVoice page for SQL Prompt where you are encouraged to submit ideas for new features. Other users can vote for ideas, and we will endeavour to investigate as many of them as possible.
Yes, you can control this from the SQL Prompt Options menu, within the Suggestions > Behaviour pane. You have two choices: either stop them displaying so frequently, or stop them displaying unless you request them using Ctrl+Space.
How-to article: SQL Prompt Tip: how to control when the suggestion box pops up
Yes, just hit the space bar after the you type in the GROUP
BY
clause, and choose All non-aggregated columns, if you want SQL Prompt to auto-fill all columns that aren't used in an aggregate function. Alternatively, you can pick the non-aggregated columns individually.
How-to article: SQL Prompt Hidden Gem: Auto-fill the GROUP BY clause
All versions of VS and SSMS ship with various built-in text markers, which are used internally for most of the IDE features that require some form of text highlighting, such as for breakpoints, bookmarks, wavy/squiggly underlines, and read-only regions.
SQL Prompt (v9 and later) repurposes these built-in text markers, rather than create custom ones. This means that we can change the color of a visible marker type using the standard VS/SSMS Tools | Options menu, rather than a SQL Prompt-specific menu.
SQL Prompt's matching objects highlight uses the VS/SSMS brace matching text marker, under the covers, so to change the default color, go to Tools | Options | Environment | Fonts and Colors, then select Brace Matching (Rectangle) and change the item background to your preferred color.
SQL Prompt offers a Dependencies tooltip but it currently only works for columns. Select the column and move your mouse over the selection so that the tooltip appears, then click the link in the tooltip and it will reveal all the objects that reference, and are being referenced by, that column.
SQL Prompt comes with some useful built-in styles, but also allows us to define custom styles. From the SQL Prompt menu, select Edit formatting styles to bring up the Formatting styles dialog. There are several ways to create a new style:
Each style defines a specified set of values for options that govern how we wish to format SQL code. Use the Style options in the left-hand pane to control the layout and formatting of the various statement, clauses, and expressions that comprise a typical SQL command.
How-to article: How to implement a SQL formatting standard using SQL Prompt v8
You can create and save as many styles as you like, and then switch between them simply by changing the Active Style from the SQL Prompt Options menu, or from within in a query window using the right-click context menu.
How-to article: Using multiple custom SQL formatting styles in SQL Prompt
Yes, simply copy the style's XML file (.sqlpromptstylev2) to a shared folder. Each member of the team then changes their style folder to the shared folder.
You can find the default file location for SQL Prompt styles from the Style folder box at the top of the Formatting styles dialog.
How-to article: Using multiple custom SQL formatting styles in SQL Prompt
When you run Format SQL, SQL Prompt will apply all the style options defined for the active style, plus any of the actions that are currently enabled to run as part of this command.
From the SQL Prompt menu, select Options, and navigate to the Format | Styles section, and you can select which actions will run automatically, as part of Format SQL.
The best way to reformat all database objects is to generate a complete database build script, format that script using SQL Prompt, use it to build a new database, and then use SQL Compare to compare the two, and generate a deployment script to alter the original database.
Alternatively, if you only need to reformat stored procedures and views, you could do this as follows:
In theory, you could extend this technique to include objects such as functions, but you might run into difficulties with dependencies and references, since you can't alter a function if it is referenced by another object, such as a table constraint, computed column, or trigger. The advantage of the technique using a build script and SQL Compare is that the latter takes care of all this for you.
How-to article: How to format a set of SQL scripts using SQL Prompt
Yes. Highlight a line or block of code and select the Disable formatting for selected text action from the Actions List. SQL Prompt will enclose the selected code with SQL Prompt formatting off / on comments, and this code won't be formatted when you run Format SQL (Ctrl K, Y).
Yes, the Unformat item, found in the Actions list, will remove all formatting whitespace from the selected code
SSMS templates and snippets are useful but have limitations. For example, you can't turn a selected query into a view, function, procedure, trigger or spExecuteSQL batch. There is no way to put dynamic macro values in automatically, for headers or inline comments. To edit an SSMS snippet, you must delve into the XML.
SQL Prompt snippets remove these limitations, and add a versatility and flexibility most programmers will appreciate. SSMS templates are compatible with Prompt snippets, but not vice versa.
SQL Prompt comes with many pre-defined snippets, as well as allowing you to create your own. To create a snippet, either from scratch, or from selected text in a query window, simply right-click in your query to bring up the context menu.
Each snippet offers various replacement points within the code, and it is simple to include multiple replacement points for the same parameter. You can also use placeholders in the snippet, making it quick and easy to insert values such as the date and logged-in developer, or database-wide values such as the database name.
To open an existing snippet within a query window, simply start typing the snippet’s name, which by convention will be the initial letters of its description, e.g. citf for "create inline table function". If you want to replace SQL Prompt’s built-in snippet with your own, you can edit it in the Snippet Manager, which you can find in the SQL Prompt menu.
You can use the $PASTE$ placeholder for this. This is handy, for example, if you have two blocks of code that need to be part of the snippet. One part you hold on the clipboard, and the other part is a block of snippet text, selected using the $SELECTEDTEXT$
placeholder.
The $DATE$ placeholder will insert the current date, in the format determined by the server's locale. However, if you prefer a different date format, such as dates in the ISO-8601 standard (e.g. '2015-07-22') then you can pass in a .NET style format string, such as $DATE(yyyy-MM-dd)$. You can also insert the current time using $TIME(HH:mm:ss)$.
Compared to normal SSMS Rename of tables, Smart Rename updates stored procedures that reference that table so that they keep working even if you rename the tables, reducing bugs and errors.
Yes, there are two features for this, both available form the right-click context menu when values are selected in an SSMS query results grid.
You can use specific values from a single column in the result set to build an IN
clause. Highlight the required column values, right-click and select Copy as IN clause. Paste them into the query, for example in the WHERE
clause, and the will be formatted as a comma-delimited list.
You can also use selected data values from the results pane to script out an INSERT
statement. Select the entire results grid, adjacent rows in a column, adjacent columns, a block of cells, or even just a single cell, then right-click and select Script as INSERT.
SQL Prompt will script out an INSERT
statement with these values, to a new SSMS tab. This script creates a temp table with the column names and data types from the original query. It inserts the selected values and drops the temp table.
How-to article: 3 Results Grid features SQL Prompt brings to SSMS
Yes, you can right-click on the icon in the gutter and select Disable actions list. Alternatively, navigate SQL Prompt | Options | Behavior and uncheck the Show actions list for selected text box.
Yes, SQL Prompt's Tab Coloring feature allows you to color code each query tab based on the environment (development, test, staging, and so on) of the server to which the tab is connected.
Open SQL Prompt's Options menu and navigate to the Tabs > Color section. You can add a database, or a server (or server group) and then define the environment, and the color of the query tab that is connected to a database in that environment. For undocked query windows, the whole window is outlined in the tab color. SQL Prompt also adds a line of the same color below the status bar.
Yes, probably. SQL Prompt keeps a history of the query tabs that you open in SSMS and can help you recover the contents of closed tabs. Click on the Tab History icon on the SSMS toolbar. The tab history window shows the file name, the SQL code, the SQL Server instance and the database to which the tab is or was connected, and the time the tab was closed.
If you recall any details of one of the tables, or other objects, referenced in the lost script, type its name into the search bar. Having located the lost script, give it a meaningful name by right-clicking the tab within the tab list and choosing the Rename menu item. Enter a name then click on it again to reopen the tab, and then save it as normal.
If the size of the tab exceeded the maximum limit, as defined in the Tabs>history pane of the Prompt Options menu, then it won't have been saved.
Click on SQL Prompt's Tab History, select just the Open documents tab and run your cursor down the list without clicking to examine the contents of each tab. When you find the one you need, move the cursor to the code pane on the right, and select the required query or block of code.