Now even after the explanation this is still a lot to take in. My recommendation to you is to dive into your server and try a few simple tasks like this. Practice makes perfect. Now I know what some of you are saying. Well I'm glad you asked, because although the example above did require a bit more code, it is important to realize that it is much more efficient.
Stored procedures have other benefits besides efficiency, though.
For a full explanation of the benefits of stored procedures, be sure to read the SQL Guru's Advice on the issue. And now I am going to show you an example of a task where using stored procedures minimizes your database calls. Assume you have the same script as before for validating usernames and passwords. All it really does is say whether it is a valid username and password. Suppose you want to add functionality in to log all failed attempts at logging on into another table called FailedLogons .