Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more
Download
Standard view
Full view
of .
Look up keyword
Like this
91Activity
0 of .
Results for:
No results containing your search query
P. 1
Writing Stored Procedures for Microsoft SQL Server

Writing Stored Procedures for Microsoft SQL Server

Ratings: (0)|Views: 1,113|Likes:
Published by viust
Writing Stored Procedures for Microsoft SQL Server
Writing Stored Procedures for Microsoft SQL Server

More info:

Published by: viust on Dec 11, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

03/15/2013

pdf

text

original

 
 Writing Stored Procedures for Microsoft SQL Server Matthew Shepker
Publisher: Sams Publishing
 
First Edition June 30, 2000
 
ISBN: 0-672-31886-5, 360 pages
Introduction
................................................................................................................ 5
Prerequisites
........................................................................................................... 5
System Requirements
........................................................................................ 5
How This Book Is Organized
............................................................................ 6
Part I: Introduction to Developing Stored Procedures
.......................... 6
Part II: Simple Stored Procedures
................................................................ 6
Part III: Security and Advanced Procedure Development
................... 6
Part IV: XML and Triggers
................................................................................ 7
Conventions Used in This Book
...................................................................... 7
Chapter 1. SQL Server and Stored Procedure Background
..................... 8
The History of Databases
.................................................................................. 8
SQL Server's History
........................................................................................... 8
SQL Server in Business Today
........................................................................ 9
Relational Database Management Systems
............................................. 10
The Features of SQL Server 2000
............................................................... 11
Uses for Stored Procedures
............................................................................ 14
Conclusion
............................................................................................................. 15
Chapter 2. Stored Procedure Camps
.............................................................. 16
What Is Business Logic?
.................................................................................. 16
Why Differences Have Come About
............................................................ 17
The All Business Logic Camp
......................................................................... 18
The No Business Logic Camp
......................................................................... 25
Finding Middle Ground
..................................................................................... 26
Conclusion
............................................................................................................. 27
Chapter 3. Processing Stored Procedures
.................................................... 28
How SQL Server Creates Stored Procedures
........................................... 28
 
How SQL Server Processes Stored Procedures
...................................... 29
Execution Plans
................................................................................................... 31
The Lazy Writer
....................................................................................................... 34
Viewing and Interpreting Execution Plans
................................................ 36
Conclusion
............................................................................................................. 42
Chapter 4. Stored Procedures Rules
............................................................... 43
Programming Stored Procedure Rules
....................................................... 43
Using Naming Conventions
............................................................................ 49
Special Stored Procedure Naming Conventions
..................................... 55
Conclusion
............................................................................................................. 56
Chapter 5. Creating and Altering Stored Procedures
............................... 57
Creating Stored Procedures
........................................................................... 57
SELECT
Statements
............................................................................................ 58
Using Cursors
....................................................................................................... 68
CREATE PROCEDURE
............................................................................................ 73
The Changing of the Code—Altering Stored Procedures
.................... 77
Alteration Considerations
................................................................................ 83
Conclusion
............................................................................................................. 85Chapter 6. Creating More Complex Stored Procedures.................................................... 86
Complex Stored Procedure Creation
.......................................................... 86
Passing Parameters into Stored Procedures
............................................ 86
Returning Information to the User
.............................................................. 90
Conclusion
........................................................................................................... 107Chapter 7. Creating Stored Procedures that Insert Data................................................. 108
Inserting Data with the
INSERT
Statement
............................................ 108
Inserting Data into Views
.............................................................................. 112
Inserting Data Based on a
SELECT
Statement
...................................... 115
Inserting Data with an
EXECUTE
Statement
........................................... 116
Minimizing Blocking Conditions
.................................................................. 116
Automating the Creation of the Code
...................................................... 119
Conclusion
........................................................................................................... 127Chapter 8. Creating Stored Procedures that Modify Data .............................................. 128
Verifying the Data to Be Modified
.............................................................. 128
Creating Procedures to Delete Data
......................................................... 135
Automating Code Creation
........................................................................... 137
Conclusion
........................................................................................................... 149Chapter 9. Providing Security for Stored Procedures..................................................... 150
Security Basics
.................................................................................................. 150
SQL Server Security
........................................................................................ 150
Stored Procedures as a Security Mechanism
........................................ 160
The
SETUSER
Function
........................................................................................ 164
Application Security
......................................................................................... 169
Ownership Chains
............................................................................................ 169
Conclusion
........................................................................................................... 170
 
Chapter 10. Programming Structures in SQL................................................................. 171
Operators
............................................................................................................. 171
Looping Structures
........................................................................................... 176
Control-of-Flow Statements
......................................................................... 179
Functions
............................................................................................................. 183
Conclusion
........................................................................................................... 193Chapter 11. Writing Utility Stored Procedures............................................................... 194
Defining Utility Stored Procedures
............................................................ 194
Utility Stored Procedure Code
..................................................................... 194
Conclusion
........................................................................................................... 242Chapter 12. Extended Stored Procedures........................................................................ 243
How Extended Stored Procedures Work
................................................. 243
Writing the Required C Code
....................................................................... 246
Registering an Extended Stored Procedure
........................................... 253
Useful System Extended Stored Procedures
......................................... 254
Conclusion
........................................................................................................... 256Chapter 13. Creating Custom Functions......................................................................... 257
New Advances in SQL Server Functions
.................................................. 257
User-Defined Functions
.................................................................................. 258
Functions That Return a Table
.................................................................... 263
Calling User-Defined Functions
................................................................... 266
Function Determinism
.................................................................................... 268
Conclusion
........................................................................................................... 271Chapter 14. SQL Server XML Support .......................................................................... 272
What Is XML?
..................................................................................................... 272
XML and HTML
................................................................................................... 273
Microsoft and XML
............................................................................................ 275
XML Fundamentals
........................................................................................... 275
Using XML with SQL Server and Internet Information Server'sServer Extensions
............................................................................................ 279
SQL XML
............................................................................................................... 283
The
FOR XML
Clause
........................................................................................ 286
Formatting Data with XSL
............................................................................. 288
XML and Style Sheets
..................................................................................... 288
Putting It All Together
.................................................................................... 289
Update Grams
.................................................................................................... 293
Setting Basic Security
.................................................................................... 295
Security Configuration for URL Access
.................................................... 295
Conclusion
........................................................................................................... 297Chapter 15. Writing Triggers.......................................................................................... 298
How Triggers Are Defined
............................................................................. 298
How Triggers Are Processed
........................................................................ 299
Creating Triggers
.............................................................................................. 301
Nested Triggers
................................................................................................. 314

Activity (91)

You've already reviewed this. Edit your review.
1 hundred reads
1 thousand reads
ptidisd liked this
carmencitaiza liked this
s@nj@y liked this
TEJASKO liked this
withrj liked this
kmdasari liked this

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->