Chapter 6: Designing Objects That Retrieve Data

Querying the database and retrieving data is possibly the most common activity executed against databases. Being a database developer involves defining tuned queries and applying Transact-SQL (T-SQL) constructions wisely to obtain the desired results in terms of the data being returned, the amount of time it takes for the database to process the query, data validation, and several other factors.

However, T-SQL code cannot exist by itself. It must be packaged in special objects that define the specific operations and context that the particular T-SQL code needs to retrieve data. There are three types of objects that retrieve data: views, stored procedures, and user-defined functions (UDFs).

In this chapter, you will learn the key design practices to apply when designing views, stored procedures, and UDFs to retrieve data. You will see when to use each of these different types of database objects, the implementation variations between them, and how to take advantage of what each has to offer. This chapter does not focus on how to design (or develop) the T-SQL code that those objects might contain. To learn how to design (or develop) the T-SQL code that views, stored procedures, and functions might contain, read Inside Microsoft SQL Server 2005: T-SQL Querying by Itzik Ben-Gan, Lubor Kollar, and Dejan Sarka (Microsoft Press, 2006).

Exam objectives in this chapter:

  • Design objects that retrieve data.
  • Design views.
  • Design user-defined functions.
  • Design stored procedures.

     Next >

 

 

© Microsoft. All Rights Reserved.