30.06.2013 Views

SQL Server Team-based Development - Red Gate Software

SQL Server Team-based Development - Red Gate Software

SQL Server Team-based Development - Red Gate Software

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 7: Maintaining a Code Library<br />

set up testing for a wiki, because the storage format is so different from the usual simple<br />

files, so automated testing will also require a lot more work.<br />

<strong>SQL</strong> Prompt<br />

<strong>Red</strong> <strong>Gate</strong> <strong>SQL</strong> Prompt is an add-on for SSMS which provides advanced code completion<br />

functionality along with various code refactoring capabilities, as well as a built-in set of<br />

Prompt snippets that can be incorporated into your scripts on the fly.<br />

When <strong>SQL</strong> Prompt is installed and running on your machine, it puts an icon in your<br />

system tray to indicate that it is monitoring activity within T-<strong>SQL</strong> windows in SSMS and<br />

in Visual Studio. It keeps track of the database to which you're currently connected and,<br />

in real time, loads each database's objects into its own management area. As you type, it<br />

provides keyword completion, and attempts to predict the objects, tables, views, columns,<br />

stored procedures, and so on, that you want to use within your T-<strong>SQL</strong> queries.<br />

<strong>SQL</strong> Prompt's built-in snippets can be accessed from within an SSMS code window via<br />

the appropriate string. For example, if you wish to create a new table in the database, type<br />

ct in a code window. By default, <strong>SQL</strong> Prompt will display a list of suggestions, which will<br />

include available snippets, along with a second code window, displaying the snippet that<br />

will be inserted. This allows you to review the snippet before inserting it into your query.<br />

If you type ct and then hit the Tab key, the CREATE TABLE snippet will automatically be<br />

added to your code, as shown in Listing 7-10.<br />

CREATE TABLE<br />

(<br />

- – column_name data_type,...<br />

)<br />

Listing 7-10: The ct (CREATE TABLE) snippet.<br />

220

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!