IV.2.2. Creating Stored Procedures and Functions

Both stored procedures and functions can be created within SQL Server. Because system stored procedures affect the server and the databases (and not the data), you will very likely be creating your own user-defined stored procedures. However, because so many built-in functions exist that can be used to work on your data, the need to create user-defined functions isn't as great.

However, the successful database developer knows how to create both — or at least knows where to look when the need arises to create a user-defined stored procedure or function.

IV.2.2.1. Creating user-defined stored procedures

Creating user-defined stored procedures is a skill that most database administrators need in day-to-day operations. If you say you can work with SQL Server, you're expected to know how to create basic stored procedures.

Darril recently went to a job interview for an application developer where this was given as one of the few questions the company asked: "Our applications frequently access databases, and we commonly create stored procedures to access the databases. Tell us about your knowledge related to creating stored procedures."

Knowing how to create and use stored procedures is often considered a core skill requirement. Your knowledge and skill set in this area may be the difference between getting a job offer or not. (By the way, Darril did get the job offer based on that interview.)

When you first start creating stored procedures, ...

Get Microsoft® SQL Server™ 2008 All-In-One Desk Reference For Dummies® now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.