Important alert: (current site time 7/15/2013 6:54:45 PM EDT)
 

article

Writing a Stored Procedure

Email
Submitted on: 7/21/2000 1:12:46 PM
By: Nathan Pond  
Level: Beginner
User Rating: By 126 Users
Compatibility: SQL Server 7.0
Views: 262039
(About the author)
 
     This article is geared for beginners wanting to learn stored procedures. No prior experience on stored procedures is required, however a basic understanding of SQL Query Language might be needed.

 
 
Terms of Agreement:   
By using this article, you agree to the following terms...   
  1. You may use this article in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this article (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this article from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the article or article's description.
				ENTER>
Writing a Stored Procedure

By Nathan Pond


If you're anything like me, you don't easily pick up on development techniques just by hearing about them. When I first installed my MS SQL server on my computer, it opened up a whole new world of features that I had never used. Among these were Stored Procedures. This article is designed to tell you how to begin writing stored procedures. I am using Microsoft SQL Server 7.0, but these examples should work in any SQL version.

Writing Stored Procedures doesn't have to be hard. When I first dove into the technology, I went to every newsgroup, web board, and IRC channel that I knew looking for answers. Through all the complicated examples I found in web tutorials, it was a week before I finally got a working stored procedure. I'll stop rambling now and show you what I mean:

Normally, you would call a database with a query like:

Select column1, column2 From Table1

To make this into a stored procedure, you simple execute this code:

CREATE PROCEDURE sp_myStoredProcedure
AS
Select column1, column2 From Table1
Go

That's it, now all you have to do to get the recordset returned to you is execute the stored procedure. You can simply call it by name like this:

sp_myStoredProcedure

Note: You can name a stored procedure anything you want, provided that a stored procedure with that name doesn't already exist. Names do not nee to be prefixed with sp_ but that is something I choose to do just as a naming convention. It is also somewhat a standard in the business world to use it, but SQL server does not require it.

Now, I realize you aren't gaining much in this example. I tried to make it simple to make it easy to understand. Later in this article, we'll look at how it can be useful, for now let's look at how you can call a Stored Procedure with parameters.

Let's say that we want to expand on our previous query and add a WHERE clause. So we would have:

Select column1, column2 From Table1
Where column1 = 0

Well, I know we could hard code the 'Where column1 = 0' into the previous stored procedure. But wouldn't it be neat if the number that 0 represents could be passed in as an input parameter? That way it wouldn't have to be 0, it could be 1, 2, 3, 4, etc. and you wouldn't have to change the stored procedure. Let's start out by deleting the stored procedure we already created. Don't worry, we'll recreate it with the added feature of an input parameter. We will drop it like this:

DROP PROCEDURE sp_myStoredProcedure

Now we can recreate it with the input parameter built in:

CREATE PROCEDURE sp_myStoredProcedure
 @myInput int
AS
Select column1, column2 From Table1
Where column1 = @myInput
Go

Ok, why don't we pause here and I'll explain in more detail what is going on. First off, the parameter: you can have as many parameters as you want, or none at all. Parameters are set when the stored procedure is called, and the stored procedure receives it into a variable. @myInput is a variable. All variables in a stored procedure have a @ symbol preceding it. A name preceded with @@ are global variables. Other than that, you can name a variable anything you want. When you declare a variable, you must specify its datatype. In this case the datatype is of type Int (Integer). Now, before I forget, here's how to call the stored procedure with a parameter:

sp_myStoredProcedure 0

If you want more than one parameter, you seperate them with commas in both the stored procedure and the procedure call. Like so:

CREATE PROCEDURE sp_myStoredProcedure
 @myInput int,
 @myString varchar(100),
 @myFloat
AS
.....
Go

And you would call it like this:

sp_myStoredProcedure 0, 'This is my string', 3.45

Note: The varchar datatype is used to hold strings. You must specify the length of the string when you declare it. In this case, the variable is assigned to allow for 100 characters to be help in it.

Now, I'm sure some of you are wondering if there is a difference for SQL calls coming from ASP. There really isn't, let's take our first stored procedure example and I'll show how it is called from ASP. If it wasn't a stored procedure, you would call it something like this:

>%
	dim dataConn, sSql, rs
	set dataConn = Server.CreateObject("ADODB.Connection")
	dataConn.Open "DSN=webData;uid=user;pwd=password" 'make connection
	sSql = "Select column1, column2 From Table1"
	Set rs = dataConn.Execute(sSql) 'execute sql call
%>

Now let's see how we call the stored procedure.

>%
	dim dataConn, sSql, rs
	set dataConn = Server.CreateObject("ADODB.Connection")
	dataConn.Open "DSN=webData;uid=user;pwd=password" 'make connection
	sSql = "sp_myStoredProcedure"
	Set rs = dataConn.Execute(sSql) 'execute sql call
%>

As you can see, the only difference is the query that is to be executed, which is stored in the sSql command. Instead of being the actual query, it is simply the name of the stored procedure. Now let's take a quick look at how you would call it with parameters. In our second example, we created the stored procedure to accept one integer parameter. Here's the code:

>%
	dim dataConn, sSql, rs, myInt
	myInt = 1 'set myInt to the number we want to pass to the stored procedure
	set dataConn = Server.CreateObject("ADODB.Connection")
	dataConn.Open "DSN=webData;uid=user;pwd=password" 'make connection
	sSql = "sp_myStoredProcedure " & myInt
	Set rs = dataConn.Execute(sSql) 'execute sql call
%>

Now, before I get to far, let me introduce the ALTER command you can use to overwrite stored procedures, so you don't have to drop them then recreate them. You can use the ALTER command like this:

ALTER PROCEDURE sp_myStoredProcedure
AS
......
Go

This will overwrite the stored procedure that was there with the new set of commands, but will keep permissions, so it is better than dropping and recreating the procedure.

As promised I am going to dive into more detail about stored procedures. Let me start out by answering a common question I received via e-mail. Many people wrote asking if it was possible, and if so how to do it, to use stored procedures do to more than select statements. Absolutely!!! Anything that you can accomplish in a sql statement can be accomplished in a stored procedure, simply because a stored procedure can execute sql statements. Let's look at a simple INSERT example.

CREATE PROCEDURE sp_myInsert
 @FirstName varchar(20),
 @LastName varchar(30)
As
INSERT INTO Names(FirstName, LastName)
values(@FirstName, @LastName)
Go

Now, call this procedure with the parameters and it will insert a new row into the 'Names' table with the 'FirstName' and 'LastName' columns approiately assigned. And here is an example of how to call this procedure with parameters from an ASP page:

>%
dim dataConn, sSql
dim FirstName, LastName
FirstName = "Nathan"
LastName = "Pond"
set dataConn = Server.CreateObject("ADODB.Connection")
dataConn.Open "DSN=webData;uid=user;pwd=password" 'make connection
sSql = "sp_myInsert '" & FirstName & "', '" & LastName & "'"
dataConn.Execute(sSql) 'execute sql call
%>

Remeber, you can use stored procedures for anything, including UPDATE and DELETE calls. Just embed a sql statement into the procedure. Notice that the above procedure doesn't return anything, so you don't need to set a recordset. The same will be true for UPDATE and DELETE calls. The only statement that returns a recordset is the SELECT statement.

Now, just because a recordset isn't returned, it doesn't mean that there won't be a return value. Stored procedures have the ability to return single values, not just recordsets. Let me show you a practical example of this. Suppose you have a login on your site, the user enters a username and password, and you need to look these up in the database, if they match, then you allow the user to logon, otherwise you redirect them to an incorrect logon page. Without a stored procedures you would do something like this:

>%
dim dataConn, sSql, rs
set dataConn = Server.CreateObject("ADODB.Connection")
dataConn.Open "DSN=webData;uid=user;pwd=password" 'make connection
sSql = "Select * From User_Table Where UserName = '" & _
	Request.Form("UserName") & "' And Password = '" & _
	Request.Form("Password") & "'"
Set rs = dataConn.Execute(sSql) 'execute sql call
If rs.EOF Then
	'Redirect user, incorrect login
	Response.Redirect "Incorrect.htm"
End If
'process logon code
.............
%>

Now let's look at how we would accomplish this same task using a stored procedure. First let's write the procedure.

CREATE PROCEDURE sp_IsValidLogon
 @UserName varchar(16),
 @Password varchar(16)
As
if exists(Select * From User_Table
Where UserName = @UserName
 And
Password = @Password)
 return(1)
else
 return(0)
Go

What this procedure does is take the username and password as input parameters and performs the lookup. If a record is returned the stored procedure will return a single value of 1, if not the procedure will return 0. No recordset is returned. Let's look at the asp you would use:

>% 
<--#INCLUDE VIRTUAL="/include/adovbs.inc"-->
dim dataConn, adocmd, IsValid
set dataConn = Server.CreateObject("ADODB.Connection")
dataConn.Open "DSN=webData;uid=user;pwd=password" 'make connection
Set adocmd = Server.CreateObject("ADODB.Command")
adocmd.CommandText = "sp_IsValidLogon"
adocmd.ActiveConnection = dataConn
adocmd.CommandType = adCmdStoredProc
adocmd.Parameters.Append adocmd.CreateParameter("return", _
adInteger, adParamReturnValue, 4)
adocmd.Parameters.Append adocmd.CreateParameter("username", _
adVarChar, adParamInput, 16, _
Request.Form("UserName"))
adocmd.Parameters.Append adocmd.CreateParameter("password", _
adVarChar, adParamInput, 16, _
Request.Form("Password"))
adocmd.Execute
IsValid = adocmd.Parameters("return").Value
If IsValid = 0 Then
	'Redirect user, incorrect login
	Response.Redirect "Incorrect.htm"
End If
'process logon code
.............
%>

Now lets slow down for a minute and I'll go through what we just did. First thing I did was create a command object for ADO. I did this with:

Set adocmd = Server.CreateObject("ADODB.Command")

Next I had to tell the object what command it would be executing, with this line:

adocmd.CommandText = "sp_IsValidLogon"

Notice that the command is the name of the stored procedure. You must tell the command object which connection (database) to use, to do this you use .ActiveConnection. .CommandType is a property that tells sql what type of command it is trying to execute. adCmdStoredProc is a constant variable declared in the include file adovbs.inc. (For more information on adovbs.inc, be sure to read ADOVBS.INC - Use It!) It represents the number telling sql that the command is to execute a stored procedure. The .Append method is used to add return values and parameters. I had to add the username and password parameters, as well as set up the return value. I then executed the command with .Execute, and .Parameters("return").Value held the return value from the procedure. I set that to the variable IsValid. If IsValid is 0, the login is incorrect, if it is 1, the login is correct.

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. One note: sometimes I get errors when I try to .Append the return value after I have already set the parameters. Meaning I might get an error if the above code looked like this:

>%
.....
Set adocmd = Server.CreateObject("ADODB.Command")
adocmd.CommandText = "sp_IsValidLogon"
adocmd.ActiveConnection = dataConn
adocmd.CommandType = adCmdStoredProc
adocmd.Parameters.Append adocmd.CreateParameter("username", _
adVarChar, adParamInput, 16, Request.Form("UserName"))
adocmd.Parameters.Append .CreateParameter("password", _
adVarChar, adParamInput, 16, Request.Form("Password"))
adocmd.Parameters.Append .CreateParameter("return", _
adInteger, adParamReturnValue, 4)
adocmd.Execute
IsValid = adocmd.Parameters("return").Value
.....
%>

I'm not exactly sure why this happens, but I just made it a habit to declare the return value first, then the parameters.

Now I know what some of you are saying. "The original ASP example for checking the username and password without using a stored procedure is so much easier, all you did was confuse me! Can Stored Procedures actually be used to improve efficiency?" 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'. If you weren't using a stored procedure you would have to make another call to the database from your ASP code. However, in the example using the stored procedure, we don't have to touch the ASP code at all, we simply modify the procedure like so:

ALTER PROCEDURE sp_IsValidLogon
 @UserName varchar(16),
 @Password varchar(16)
As
if exists(Select * From User_Table 
Where UserName = @UserName
 And
Password = @Password)
 begin
 return(1)
 end
else
 begin
 INSERT INTO FailedLogons(UserName, Password)
 values(@UserName, @Password)
 return(0)
 end
Go

Wasn't that neat? But that's not all, while we're at it why not add a little more functionality? Let's say that we want to run a check on each incorrect login, and if there have been more than 5 incorrect logins for that username within the past day, that account will be disabled. We would have to have the 'FailedLogons' table set up to have a 'dtFailed' column with a default value of ('GetDate()'). So when the incorrect logon is inserted into the table, the date and time is recorded automatically. Then we would modify our stored procedure like this:

ALTER PROCEDURE sp_IsValidLogon
 @UserName varchar(16),
 @Password varchar(16)
As
if exists(Select * From User_Table
Where UserName = @UserName
 And
Password = @Password
			And
		Active = 1)
 begin
 return(1)
 end
else
 begin
 INSERT INTO FailedLogons(UserName, Password)
 values(@UserName, @Password)
 
 declare @totalFails int
 Select @totalFails = Count(*) From FailedLogons
 Where UserName = @UserName
 And dtFailed > GetDate()-1
 if (@totalFails > 5)
 UPDATE User_Table Set Active = 0
 Where UserName = @UserName
 return(0)
 end
Go

Now, let's take a closer look at what I was doing. First thing, check to see if the username and password exist on the same row, and that that user is active, if so, login is fine, return 1 to the user and exit the procedure. If the login is not ok though, we want to log it. The first thing the procedure does is insert the record into the 'FailedLogons' table. Next we declare a variable to hold the number of failed logons for that same day. Next we assign that value by using a sql statement to retrieve the number of records for that username, within the same day. If that number is greater than 5, it's likely someone is trying to hack that account so the the username will be disabled by setting the active flag in the 'User_Table' to 0. Finally, return 0 letting the calling code (ASP) know that the login was unsuccessful. To accomplish this same task using only ASP, you would have needed to make 4 database calls. The way we just did it it is still only one database call, plus the fact that all that functionality we added at the end was in the stored procedure, we didn't have to touch the ASP code at all!

Note about 'begin/end': When using an 'If' statement in a stored procedure, as long as you keep the conditional code to one line you won't need a 'begin' or 'end' statement. Example:

if (@myvar=1)
 return(1)
else
 return(2)

However, if you need more than one line, it is required that you use begin and end. Example:

if (@myvar=1)
 begin
 do this.....
 and this.....
 return(1)
 end
else
 begin
 do this....
 return(2)
 end

I hope that I have given enough information to keep you active in learning stored procedures. If you're anything like me, getting the basics is the hard part, from there you can experiment and learn on your own. That is why I decided to create this article. Feel free to e-mail me at nathan@npond.com with any questions or comments about any of my articles.

Happy Programing!


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Beginner category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

7/22/2000 2:30:20 PMgary.klemm@weirton.com

Stored Procedures
(If this comment was disrespectful, please report it.)

 
7/24/2000 3:35:09 PMLeo

Good Job!!!
(If this comment was disrespectful, please report it.)

 
7/25/2000 5:43:14 PMImran

Nathan I love the way you explained Stored procedure. I have use stored procedure in Oracle for my class project. Since you mentioned you Installed SQL SERVER 7.0 I was wondering what books did you buy for administration MS SQL SERVER 7.0
What books really helped you.
Because I have to install it on my NT Server which I just installed 2 day ago.
I have no clue how am I going to install it and administor it. I will be using MS SQL SERVER for my upcomming projects. So can you HELP.
Regards
Imran

(If this comment was disrespectful, please report it.)

 
7/25/2000 10:18:12 PMNathan Pond

Imran,
Actually I don't really have any recommendations. I first learned some of the basics on usign MS SQL 6.5, and then a friend helped me upgrade to 7.0. Most of the stuff I learned was just from playing around with it. SQL 7 is VERY easy to install. I'm sure there are some good books out there, I'm just not sure which ones are the best. Try visiting sqlin.com, they might have some suggestions there.

Regards,
Nathan
(If this comment was disrespectful, please report it.)

 
7/28/2000 10:53:02 AMSam Abraham

A well explained mix of Asp, and stored procedures yet simple to understand even for Sql Server beginers like me. Articles like this are an asset to the programming community. A job well done.
(If this comment was disrespectful, please report it.)

 
7/29/2000 1:52:13 PMBrian Lockwood

Excellent article this is the "RIGHT" way to do data access. For a tool that can write stored procedures automatically and uses ADO command objects in VB or ASP to call them using this same syntax see www.lockwoodtech.com. There are products for SQL Server and MS Access. Note: This one (little known) Meta tag will replace the ADOVBS.inc. It picks up all ADO constants automatically. ""
(If this comment was disrespectful, please report it.)

 
8/3/2000 10:24:08 AMManish

Fantastic. Well, there are tons of site and lot of articles telling you about stored procedures and not to add some articles are not worded nicely. This article was not only worded nicely put was exactly what one would to start writing stored procedure. And to top it all
(If this comment was disrespectful, please report it.)

 
8/23/2000 1:27:34 PMTopaz2000

Perfect Just what I was looking for
Thanks to the Author and planet-source-code
(If this comment was disrespectful, please report it.)

 
10/26/2000 2:02:04 AMCharl

Thanks Nathan for your help.
Now i can jump into using SP's as I am currently creating software that will need the most effecient menas of finding and returning data from a huge DB.
Thanks
(If this comment was disrespectful, please report it.)

 
10/26/2000 2:03:39 AMCharl

Thanks Nathan, this tutor was very useful to me as a newby in SP's.
I will definatley be using SP's for more effecient queries to by Db via my ASP pages and VB apps.
Thank you.
(If this comment was disrespectful, please report it.)

 
11/28/2000 2:35:36 AMErnest

Hi! I like the way you presented. You let me know the Stored Procedures easily. Keep on! I will read what you write!! One thing that I do not like. The page is not printer friendly. Some text at the right side are truncated!!
(If this comment was disrespectful, please report it.)

 
1/2/2001 3:40:21 PMmmroberts

Excellent article. It was referred to me by a friend who is learning SQL. I am a web developer who struggled with learning this stuff on my own. I wish I would have had this article then! Keep up the good work!
(If this comment was disrespectful, please report it.)

 
3/8/2001 4:11:00 PMJoseph M. Ferris

Nathan, Great Job! Need a quick refresher on SP's and this did the trick. Thanks.
(If this comment was disrespectful, please report it.)

 
4/19/2001 5:06:08 PMsampathgowri

Hi,
It was really very good. Why don't you give one full project description. Telling as how to start, screen design, step by step,till reports, etc.
Thanks and Regards
sampathgowri

(If this comment was disrespectful, please report it.)

 
4/24/2001 6:02:32 AMDaniel Kent

Are you aware that prefixing user defined stored procedures with sp, as you have done in this article, makes their performance slightly worse than using another prefix?

This is because SQL server uses sp for built in stored procedures. When you call a stored procedure that starts with sp, SQL server will look for the built in procedure first, slowing your procedure calls down.
(If this comment was disrespectful, please report it.)

 
4/24/2001 6:06:03 AMDaniel Kent

Are you aware the prefixing user defined stored procedures with "sp" degrades their performance slightly?

SQL server uses sp as a prefix for its built in stored procedures. If you prefix your stored procedures with sp, SQL server will check for a built in stored procedure first, slighly affecting performance. Its a small amount but as we can choose whatever we want to prefix our sprocs, its worth bearing in mind.

Good article though!
(If this comment was disrespectful, please report it.)

 
5/28/2001 5:20:06 PMJohanna

This really is excellent! I developed an understanding of stored procedures, and saw how I could put it to use in an ASP application in 5(!) minutes!

Thanks, and I look forward to more of your tutorials!
Johanna
(If this comment was disrespectful, please report it.)

 
6/5/2001 11:45:24 AMmeyy

good work! keep it up

do u have any help writing stored procedure to typically create a flat file from the database in comma seperated format..

thanks

palani60173@lycos.com



(If this comment was disrespectful, please report it.)

 
8/18/2001 1:13:56 PMmax mail

cool article. the reason you have to append the 'return' parameter to the parameters collection first is because the stored procedure returns its value before any other output parameter. the order of other parameters appended to the collecttion has to match the order of parameters declared in the stored procedure (i tested this on sql 2000).

(If this comment was disrespectful, please report it.)

 
8/23/2001 4:40:08 AMKishore Kumar

Excellent article for a beginner like me, thanks a lot, please keep posting like this, once again thanks a lot
(If this comment was disrespectful, please report it.)

 
9/18/2001 4:55:38 PMEric Krauss

This article is PERFECT!!!! I just got a SQL 2000 Server for my databases yesterday and the stored procedures were the only thing I could not figure out. I went out and bought a book, looked all over the internet, and nothing. After reading your article I understand it like it is plain english!!! A great service to all beginning SQL programmers!
(If this comment was disrespectful, please report it.)

 
1/14/2002 12:36:07 AMGreg Beard

Excellent - thanks.
(If this comment was disrespectful, please report it.)

 
2/7/2002 11:19:03 PMDerreck

YOU ARE DA MAN!!! Finally, i can automate tasks in my shopping cart programs, and reduce overhead. You are a life saver!
(If this comment was disrespectful, please report it.)

 
3/18/2002 4:52:12 AMweng54

thanks man!
(If this comment was disrespectful, please report it.)

 
3/19/2002 7:49:26 AMIvin

Execellent...it was short
(If this comment was disrespectful, please report it.)

 
3/19/2002 7:53:50 AMIvin

Excellent
(If this comment was disrespectful, please report it.)

 
6/20/2002 5:57:09 AMRags

Good One Man :)
(If this comment was disrespectful, please report it.)

 
6/26/2002 7:18:46 AMSomenath Dey

Excellent Contents.. Perfect for some one like me new to this area.. Good job done..
(If this comment was disrespectful, please report it.)

 
7/6/2002 7:13:06 AMAlkesh Parikh

Excellent Article...Thanks a lot ...u make work so much easier for so many devlopers like me...keep it up
(If this comment was disrespectful, please report it.)

 
7/19/2002 2:11:43 PMSaverio Mercurio

A bit late, but previous comments regarding not using "sp" as the prefix should actually be that you shouldn't use "sp_" (note the underscore). It's OK to use "sp" (e.g., "spMyStoredProc"). From the SQL Server Online doc:

It is strongly recommended that you do not create any stored procedures using sp_ as a prefix. SQL Server always looks for stored procedures beginning with sp_ in this order:

1. Look for the stored procedure in the master database first.
2. Look for the stored procedure based on any qualifiers provided (database name or owner).
3. Look for the stored procedure using dbo as the owner, if one is not specified.
(If this comment was disrespectful, please report it.)

 
9/25/2002 10:47:28 PM

Sir, I need some explanation on Sql Server 7. How u can link a SQL Server 7 to different platform such as Linux, Sun Solaris.Need help urgently.Pls give some idea . sumipraveen@hotmail.com
(If this comment was disrespectful, please report it.)

 
11/20/2002 2:38:01 PM

great article!
by the way, i think sp_ stands for system procedure and not stored procedure.
(If this comment was disrespectful, please report it.)

 
1/29/2003 2:58:09 AM

Thanks. You are a life
(If this comment was disrespectful, please report it.)

 
2/12/2003 9:27:56 AMFelipe Lima A. Menezes

Great article!
(If this comment was disrespectful, please report it.)

 
3/16/2003 10:06:20 PM

Thanks for your article. Using plain common sense explanations helped me to know
(If this comment was disrespectful, please report it.)

 
4/5/2003 6:23:08 AMgswgroup

Thanks Nathan, I read this article on 4guysfromrolla.com and thanks so much for teaching me sql server stored procedures, and accessing them with ADO.

Thanks again,
(If this comment was disrespectful, please report it.)

 
4/10/2003 2:34:40 AM

where can I find the exact same (wonderful) explanation of stored procedures but for calling them from VB 6.0 (not .asp)?

(If this comment was disrespectful, please report it.)

 
7/8/2003 10:27:12 PM

this is not so complecated and easy thats why it is great.
(If this comment was disrespectful, please report it.)

 
7/16/2003 10:56:50 AM

Hi, The article was very good and everything will work perfectly for SQL Server, however Oracle is another ugly beast that does not work quite as cleanly as SQL Server and requires things such as cursors and packages to return multiple resultsets. Good job though covering SQL Server!
(If this comment was disrespectful, please report it.)

 
2/17/2004 3:15:01 AM

It was a really helpful article for me to understand how to use stored procedures. Thank you so much for being kind enough to write this article in a manner others can easily understand. I think you have been 100% successful on this article. Again thank you very much and wish you all the best in your future.
(If this comment was disrespectful, please report it.)

 
2/26/2004 3:24:00 AMTestguru

I pasted some of the portion in the word and took print out. It is inserting character Q after every word can anybody tell me how to overcome it.
(If this comment was disrespectful, please report it.)

 
4/17/2004 8:45:09 AM

Very good & very easy Thanks man
(If this comment was disrespectful, please report it.)

 
5/27/2004 4:24:59 AM

Thank you so very much for your great help!!!
(If this comment was disrespectful, please report it.)

 
7/9/2004 2:42:21 AMandrew

Good stuff. Keep up the good work
(If this comment was disrespectful, please report it.)

 
7/10/2004 6:49:07 AM

Thanks to you Nathan for helping me out on working with Stored Procedures. I am a beginner on SQL Server2000 and I dont have knowledge on Stored Procs. Your article helps me understand and get me started to work with SP's. Thanks again.
(If this comment was disrespectful, please report it.)

 
9/1/2004 2:39:34 PM

Very Helpful article. Very easy to understand. Good Job.
(If this comment was disrespectful, please report it.)

 
9/22/2004 5:07:22 AM

It really helped me in understanding the basic steps of writing stored procedures..Thanks for giving such valuable notes!!
(If this comment was disrespectful, please report it.)

 
9/24/2004 3:42:06 AM

want To learn more in Stored Procedure
Can U guide me?

(If this comment was disrespectful, please report it.)

 
2/8/2005 5:31:39 PMBradFlood

I wrote my wrote and executed my first stored procedure in 5 minutes. Great Guide! Thanks. :)
(If this comment was disrespectful, please report it.)

 
2/22/2005 7:18:39 AM

Great.It really helped me in understanding the basic steps of writing stored procedures..Thanks for giving such valuable notes.can i use it with delphi since want to hide password from unauthorized users and have user-login table and user-login form , if so would u give me idea .
(If this comment was disrespectful, please report it.)

 
2/22/2005 7:24:41 AM

thanks much , now i m clear about stored preocdure. i have database project ms-sql server with delphi 7 , i have user-login table with field username and userpassword , and have userloginForm , so to hide password from unathorized users . so how to manage it , any help
(If this comment was disrespectful, please report it.)

 
4/21/2005 2:33:06 AMGanesh

This is really great
(If this comment was disrespectful, please report it.)

 
3/1/2006 8:35:25 PMYoga_Raj

You have great potential in becoming a professional technical facilitator or perhaps a good technical book author.
(If this comment was disrespectful, please report it.)

 
7/2/2006 5:24:26 AMCataLyst-KK

Hello,

nice work. i think you forgot one topic of returning outputs.

@FirstName varchar(20) output

now this will return an output in VB or some else languages.
(If this comment was disrespectful, please report it.)

 
5/8/2007 10:18:45 PMRahat651

Good work. But did not write on relation between multiple stored procedures.
(If this comment was disrespectful, please report it.)

 
7/13/2007 6:34:04 AMimbcsdn

FINANCE FOR SMALL BUSINESS

IMBC SDN.BHD from Malaysia willing to invest in small and medium sized company/business (any type of business).


„« Very Less Interest
„« Loan based on Postdated Cheques
„« Less Documentation
„« Loan ranging from 5, 00,000 to 10, 0000,000 with easy repayment options
„« Company should be in India
„« Processing period one week

Contact:
Mr.Vasan,
General Manager,
IMBC.SDN.BHD
Ph: 0060146301333.
or
E-Mail to: detect@idmservices.net

(If this comment was disrespectful, please report it.)

 
2/4/2008 4:29:31 AMNavasKhan

Its really good
(If this comment was disrespectful, please report it.)

 
3/4/2008 4:55:16 AMShruti

Superb Article! Its really easy to understand. Thanks so much.
(If this comment was disrespectful, please report it.)

 
5/20/2013 10:22:53 AMD.Ravi

superb....thanks
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.