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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

207<br />

Chapter 7: Maintaining a Code Library<br />

Use of multiple files makes it much easier to develop versions and branches for each<br />

individual code snippet and one can modify, add or delete files individually and safely.<br />

Using a single file removes much of this flexibility, and modifying a single file makes it<br />

likely that you will accidentally change code you didn't mean to change.<br />

I strongly recommend maintaining a library of individual files. You can check them into<br />

source control, and then share the directory with the team. You will also find it much<br />

easier to work with, and maintain, these individual files in tools such as SSMS or <strong>Red</strong><br />

<strong>Gate</strong> <strong>SQL</strong> Prompt.<br />

Tools for Creating and Managing Code Libraries<br />

It is possible to simply use Notepad or WordPad within Windows, do a search against the<br />

code and snippets to find what you need, and then copy and paste. However, that can be<br />

a lot of work and there are, fortunately, better and more efficient tools with which to<br />

manage your code library. For example:<br />

• SSMS provides templates which allow us to define our own outlines for creating or<br />

modifying database objects<br />

• third-party text-editing tools, such as EditPlus, have built in snippet management<br />

• wikis, for example TiddlyWiki or WikidPad, allow us to create a searchable database of<br />

scripts, although these tools won't work well with source control<br />

• advanced snippet and code management tools, like <strong>Red</strong> <strong>Gate</strong>'s <strong>SQL</strong> Prompt, are also<br />

available.<br />

Over the coming sections, we'll discuss the benefits and limitations of each of the listed<br />

solutions, but there are other options. You could even go so far as to use publicly available<br />

online storage engines, such as SNIPPLR, from http://snipplr.com/.

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

Saved successfully!

Ooh no, something went wrong!