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 9: Searching DDL and Build<br />

Scripts<br />

Often, a database developer needs to go beyond high-level object searches, to find<br />

occurrences of a specific string, such as a parameter name, within the DDL of the<br />

databases you manage. It's at these times that the absence of an effective search utility in<br />

SSMS really hits home. Of course, there is a Find menu item (CTRL+F) but it won't work<br />

in the Object Explorer pane of SSMS to find things in your database schema. You also<br />

have an object search feature in SSMS 2008 within the Object Explorer Details window,<br />

but that only searches the names of objects, not their definitions. It also doesn't search<br />

all objects, not even columns. Obviously, you can find strings within the current query<br />

window, but this is only a small fraction of what you actually need when you're<br />

developing a database. You want to search for all your database objects, their names,<br />

their definitions and their comments.<br />

In this chapter, I'll show how to search within the object definitions in your build scripts<br />

to find occurrences of a specific string, using:<br />

• <strong>SQL</strong> Search – a free search tool provided by <strong>Red</strong> <strong>Gate</strong><br />

• custom scripts – <strong>based</strong> on the catalog and INFORMATION_SCHEMA views.<br />

With these scripts to hand, and a few more, I'll move on to how to make use of SSMS<br />

shortcut keys to enable you select the name of an object, particularly a table, and to<br />

instantly see, at a keystroke, the build script in the results pane, complete with the<br />

documentation and, in the case of a table, the referential constraints. I'll also show<br />

how to get a list of all the places in the database where the object's name appears.<br />

A dream? Read on …<br />

260

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

Saved successfully!

Ooh no, something went wrong!