Chapter 7. Building Queries Dynamically

After completing this chapter, you will be able to:

  • Build a query using SQL Server Management Studio’s Query Builder

  • Retrieve information about a database from the database’s system tables

  • Create simple queries dynamically, based on user input

  • Format user input to sort and filter sophisticated dynamic queries

  • Parse and reformat dates for use in a filter

  • Protect your database from a “SQL-injection” attack

  • Use sp_executeSql to submit a query

In the previous chapter, you learned how to increase the performance of your queries. Now you know how to create an efficient set of queries to give your users the most important information from your application using predefined queries in stored procedures or views.

However, ...

Get Microsoft® SQL Server™ 2005: Applied Techniques Step by Step now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.