create procedure pp123
(
@ID INT,
@NAME varchar(50),
@MARK INT
)
AS
BEGIN
set nocount on
if @MARK=1
INSERT INTO emp VALUES(@ID,@NAME)
ELSE IF @MARK=2
UPDATE emp SET NAME=@NAME WHERE ID=@ID
ELSE IF @MARK=3
DELETE FROM emp WHERE ID=@ID
ELSE IF @MARK=4
SELECT * FROM emp
set nocount off
END
EXECUTE OF THE PROCEDURE
exec pp123(1,'siv')
No comments:
Post a Comment