Wednesday, April 16, 2008

Simple Storeprocedure

INSERT:-
========================
CREATE PROCEDURE SP_INSERT_VALUES
(
@ProdName char(50), @active bit, @SortOrder int
)
as
INSERT INTO atmt_products (ProdName,active,SortOrder )
VALUES
(@ProdName,@active,@SortOrder)
return @@identity
GO
=================================
UPDATE:-
===========================
CREATE PROCEDURE SP_UPDATE_VALUES
(
@prodid int, @ProdName Nchar(50), @active bit, @SortOrder int)
as
UPDATE atmt_products SET ProdName=@ProdName,active=@active,SortOrder=@SortOrder
WHERE
prodid=@prodid
GO
==========================
DELETE:-
========================
CREATE PROCEDURE SP_DELETE
(
@prodid int
)
as
delete from atmt_products WHERE prodid=@prodid
GO

No comments:

Loading...