Stored procedures are the mainstay of application programming with SQL Server. Typically, applications that perform well and that are easily managed employ stored procedures exclusively for their data retrieval and update needs. This helps facilitate centralized management of queries, the ability to change data models and tune queries without rewriting code, and the ability to manage transactions without user intervention. User -defined functions, a new feature for SQL Server 2000, provide further encapsulation of logic into highly reusable and efficient components . This chapter combines what you learned in Chapter 5, "Advanced Data Retrieval and Modification," about writing queries and in Chapter 6 about writing batches and scripts to show you the logical extension of those things: writing reusable queries and batches that can be accessed from applications to provide consistent output and central change control. |