Normal
0
false
false
false
EN-US
X-NONE
X-NONE
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0in;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
Class Review of Chapters for 5 HW
Chapter 5 – Understanding Stored
Procedures
1. What are stored
procedures?
2. What do you need to
get started?
3. Write your first
stored procedure
4. Write a more
sophisticated stored procedures
5. Input Variables
6. Input Variables
with SELECT and UPDATE Statements
7. Conclusion
Getting Started with Stored Procedures
What do I
need to get started? I have heard that question often. To begin writing
stored procedures, the following are essential:
1. A database
management system.
2. A database built
inside the database management system (see the end of this article for a
sample).
3. A text editor, such
as Notepad or Query Analyzer.
Items 1
and 2 are absolutely essential. You can’t write stored procedures without a
database. They would be useless. Sometimes, I write my procedures in Notepad
(or another text editor), and copy them into the New Stored Procedure window in
SQL Server. The New Stored Procedure window is a bit small, and in Notepad I
can spread things out a bit (you’ll see later).
Next, you
will have to decide what you want your stored procedure to do. It can be
tempting to just dive right into the task at hand, but it is always prudent to
sketch out some ideas first. Some considerations should be:
·
Do
you want to view data in the database (SELECT), insert new records (INSERT
INTO), or do I want to change an existing record (UPDATE)?
·
With
which tables will you have to work? Does it make sense to create a VIEW
first?
·
How
often will this procedure actually be used?
Once you
have struggled with these questions (something of an exaggeration, I guess),
you will be ready to start coding!