CREATING THE STORED PROCEDURE

Open Enterprise Manager, and open your database in the tree structure. Right click on Stored Procedures and select 'New Stored Procedure'

Let's create a procedure called getproducts

Here we have created a variable called

@product_id

and passed it to our SQL select statement. All variables have the @ sign before them in SQL language.

Now, from within your ASP page, you can call this procedure in a number of ways.

As the procedure in this case is a select statement, you will most likely want to receive the results into a recordset:


If however the procedure was an update statment - for example,

update products set delivered=1 where product_id=@product_id


then you might want simply to execute the procedure as follows: