Write a stored procedure for MS SQL

Connect to your database through an application such as Enterprise Manager, go to your database, right click stored procedures and select new. Below is a basic example of a stored procedure:

CREATE PROCEDURE spStoredPrcedureName

@variable1 int,
@variable2 varchar(64)

AS

select id from someTable where column1 = @variable1 AND column2 = @variable2

Go

Share on Twitter
Share on Facebook