The following example is for creating a simple delete stored procedure. You can run it through an explicit call from a host language program or directly from a DBMS query execution shell like SQL Server Management Studio or dbOrchestra.
IF ( OBJECT_ID('dbo.sp_Students_DEL_byPK') IS NOT NULL ) DROP PROCEDURE dbo.sp_Students_DEL_byPK GO CREATE PROCEDURE dbo.sp_Students_DEL_byPK @student_id INT AS BEGIN SET NOCOUNT ON DELETE dbo.Students FROM dbo.Students WHERE student_id = @student_id END GO
To run the stored procedure you need to supply a values to the applicable variables.
-- @student_id IN INT EXEC dbo.sp_Students_DEL_byPK @student_id = 25 GO