Home > Store > Data > SQL Server

Writing Stored Procedures for Microsoft SQL Server

Register your product to gain access to bonus material or receive a coupon.

Writing Stored Procedures for Microsoft SQL Server

Best Value Purchase

Book + eBook Bundle

  • Your Price: $43.19
  • List Price: $71.98
  • About Adobe DRM eBooks
  • This eBook requires the free Adobe® Digital Editions software.

    Before downloading this DRM-encrypted PDF, be sure to:


    • Install the free Adobe Digital Editions software on your machine. Adobe Digital Editions only works on Macintosh and Windows, and requires the Adobe Flash Player. Please see the official system requirements.
    • Authorize your copy of Adobe Digital Editions using your Adobe ID (select AdobeID as the eBook vendor). If you don't already have an Adobe ID, you can create one here.

More Purchase Options

Book

  • Your Price: $31.99
  • List Price: $39.99
  • Usually ships in 24 hours.

eBook (Adobe DRM)

  • Your Price: $25.59
  • List Price: $31.99
  • About Adobe DRM eBooks
  • This eBook requires the free Adobe® Digital Editions software.

    Before downloading this DRM-encrypted PDF, be sure to:


    • Install the free Adobe Digital Editions software on your machine. Adobe Digital Editions only works on Macintosh and Windows, and requires the Adobe Flash Player. Please see the official system requirements.
    • Authorize your copy of Adobe Digital Editions using your Adobe ID (select AdobeID as the eBook vendor). If you don't already have an Adobe ID, you can create one here.

Description

  • Copyright 2000
  • Dimensions: 7.375 X 9.125
  • Pages: 450
  • Edition: 1st
  • Book
  • ISBN-10: 0-672-31886-5
  • ISBN-13: 978-0-672-31886-3
  • eBook (Adobe DRM)
  • ISBN-10: 0-7686-5699-0
  • ISBN-13: 978-0-7686-5699-2

Writing Stored Procedures for Microsoft SQL Server focuses on teaching you not only how to build effective stored procedures, but also how to optimize and streamline them for long term use. Get an understanding of how SQL Server interprets stored procedures verses direct access via SQL queries. This is followed by detailed instructions on creating and maintaining a repository of stored procedures. Once you know how stored procedures are created and built, you are taught how to determine which logic within an application makes sense to be put into this scheme. Additionally, you're provided with guidance on making stored procedures that are portable across applications.

Downloads

Downloads

SQL code for all the chapters - 228 kb -- allfiles.zip

SQL code for Chapter 1 - 25 kb -- chapter1.exe

SQL code for Chapter 1 - 24 kb -- chapter1also.exe

SQL code for Chapter 2 - 63 kb -- chapter2.exe

SQL code for Chapter 4 - 23 kb -- chapter4.exe

SQL code for Chapter 5 - 23 kb -- chapter5.exe

SQL code for Chapter 6 - 27 kb -- chapter6.exe

SQL code for Chapter 7 - 27 kb -- chapter7.exe

SQL code for Chapter 8 - 29 kb -- chapter8.exe

SQL code for Chapter 9 - 27 kb -- chapter9.exe

SQL code for Chapter 10 - 26 kb -- chapter10.exe

SQL code for Chapter 11 - 35 kb -- chapter11.exe

SQL code for Chapter 13 - 28 kb -- chapter13.exe

SQL code for Chapter 16 - 27 kb -- chapter16.exe

Sample Content

Table of Contents



Introduction.

I. INTRODUCTION TO DEVELOPING STORED PROCEDURES.

1. SQL Server and Stored Procedure Background.

The Old Staple Functionality. New Functionality.

Uses for Stored Procedures. Conclusion.

2. Stored Procedure Camps.

What Is Business Logic? 9. Why Differences Have Come About.

The All Business Logic Camp. Advantages of Business Logic in the Database. Disadvantages of Business Logic in the Database.

The No Business Logic Camp. Advantages of the No Business Logic Camp. Disadvantages of the No Business Logic Camp.

Finding Middle Ground. Conclusion.

3. Processing Stored Procedures.

How SQL Server Creates Stored Procedures. How SQL Server Processes Stored Procedures.

Deferred Name Resolution. Creation of an Execution Plan.

Execution Plans.

Execution Plan Makeup. How SQL Server Chooses Query Plans. Aging and Deallocating Execution Plans. Execution Plan Recompilation.

Viewing and Interpreting Execution Plans. Conclusion.

4. Stored Procedures Rules.

Programming Stored Procedure Rules.

Basic Rules. Referencing Objects in Stored Procedures. Source Code Protection. ODBC Options. Deferred Name Resolution and Query Plan Creation.

Using Naming Conventions.

Microsoft Discrepancies in Naming Convention. Microsoft Identifier Rules. Suggested Naming Conventions.

Special Stored Procedure Naming Conventions. Conclusion.

II. SIMPLE STORED PROCEDURES.

5. Creating and Altering Stored Procedures.

Creating Stored Procedures. SELECT Statements.

Limiting the Number of Columns. Limiting the Number of Rows.

Using Cursors.

Creating Cursors in SQL Server. Using the DECLARE Statement.

CREATE PROCEDURE. The Changing of the Code—Altering Stored Procedures.

The Old Way. The New Way—ALTER PROCEDURE.

Alteration Considerations. Conclusion.

6. Creating More Complex Stored Procedures.

Complex Stored Procedure Creation. Passing Parameters into Stored Procedures. Returning Information to the User.

The RETURN Statement. The PRINT Command. The RAISERROR Function. OUTPUT Parameters.

Conclusion.

7. Creating Stored Procedures that Insert Data.

Inserting Data with the INSERT Statement. Inserting Data into Views. Inserting Data Based on a SELECT Statement. Inserting Data with an EXECUTE Statement. Minimizing Blocking Conditions. Automating the Creation of the Code. Conclusion.

8. Creating Stored Procedures that Modify Data.

Verifying the Data to Be Modified. Creating Procedures to Delete Data. Automating Code Creation. Conclusion.

III. SECURITY AND ADVANCED PROCEDURE DEVELOPMENT.

9. Providing Security for Stored Procedures.

Security Basics. SQL Server Security.

Logins. Users. Roles. Permissions. Permission States. Assigning Permissions. Adding Logins and Users.

Stored Procedures as a Security Mechanism. Application Security. Ownership Chains. Conclusion.

10. Programming Structures in SQL.

Operators.

Assignment Operator. Arithmetic Operators. Comparison Operators. Logical Operators. String Concatenation Operator. Bitwise Operators. Unary Operators.

Looping Structures.

WHILE Loop. GOTO Loop.

Control-of-Flow Statements.

IF ELSE. CASE.

Functions.

String Functions. Date Functions. Mathematical Functions. System Functions.

Conclusion.

11. Writing Utility Stored Procedures.

Defining Utility Stored Procedures. Utility Stored Procedure Code.

Updating Index Statistics. Reindexing a Database. Finding Object Permissions. Finding Database-Level Permissions. The New sp_who. Checking for Blocks. Checking Table Sizes. Numbering Source Code Lines. Retrieving Index Members.

Conclusion.

12. Extended Stored Procedures.

How Extended Stored Procedures Work. Writing the Required C Code. Registering an Extended Stored Procedure. Useful System Extended Stored Procedures. Conclusion.

13. Creating Custom Functions.

New Advances in SQL Server Functions. User-Defined Functions. Functions That Return a Table.

Multi-Statement Tabular Functions. In-Line Functions.

Calling User-Defined Functions. Calling Scalar Functions. Calling Tabular Functions. Calling Built-in Functions.

Function Determinism. User-Defined Function Determinism. Determinism of System Functions.

Conclusion.

IV. XML AND TRIGGERS.

14. SQL Server XML Support.

What Is XML? 9. XML and HTML. Microsoft and XML. XML Fundamentals.

A Basic XML Demonstration.

Using XML with SQL Server and Internet Information Server's Server. Extensions.

Creating a Test Database. Installing the Server Extensions. Using the Registration Tool Snap-in (Regxmlss Utility).

SQL XML.

Creating a URL Query. Canning a Query. Passing Parameters.

The FOR XML Clause.

FOR XML RAW. FOR XML AUTO. FOR XML EXPLICIT.

Formatting Data with XSL.

XSL Versus CSS.

XML and Style Sheets.

Enabling an XML Document for Browsing with Style Sheets.

Putting it All Together.

Creating the XML Template File. Creating the Style Sheet. Creating the HTML Document.

Update Grams.

The Update Gram Standard Format.

Setting Basic Security. Security Configuration for URL Access.

Using IIS Directory Security Settings.

Conclusion.

15. Writing Triggers 297.

How Triggers Are Defined. How Triggers Are Processed.

AFTER Triggers. INSTEAD OF Triggers.

Creating Triggers.

Building an AFTER Trigger. Building INSTEAD OF Triggers. Trigger Restrictions.

Nested Triggers. Problems with Triggers. Conclusion.

16. Considerations When Using Stored Procedures and Triggers.

Problems with Stored Procedures.

Blocking. Sequential Numbering.

Problems with Triggers. General Performance Issues. Conclusion.

Index.

Updates

Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership