ProjetThe/ProjetTheAlone/Model - Copie/P_T_listParticipant.sql

51 lines
1.2 KiB
MySQL
Raw Normal View History

2019-01-24 22:24:05 +01:00
CREATE PROCEDURE AjouterT_listParticipant
@ID_LP int OUTPUT,
@ID_equipe int,
@ID_benificiaire int
AS
INSERT INTO T_listParticipant(ID_equipe,ID_benificiaire)
VALUES(@ID_equipe,@ID_benificiaire)
SET @ID_LP=@@IDENTITY
RETURN
GO
CREATE PROCEDURE ModifierT_listParticipant
@ID_LP int,
@ID_equipe int,
@ID_benificiaire int
AS
IF(@ID_LP IS NULL OR @ID_LP=0)
RAISERROR('Identifiant requis !',16,1)
ELSE UPDATE T_listParticipant
SET ID_equipe=@ID_equipe,ID_benificiaire=@ID_benificiaire
WHERE ID_LP=@ID_LP
RETURN
GO
CREATE PROCEDURE SelectionnerT_listParticipant
@Index VARCHAR(10)
AS
IF(@Index='ID_equipe') SELECT * FROM T_listParticipant ORDER BY ID_equipe
ELSE IF(@Index='ID_benificiaire') SELECT * FROM T_listParticipant ORDER BY ID_benificiaire
ELSE SELECT * FROM T_listParticipant ORDER BY ID_LP
RETURN
GO
CREATE PROCEDURE SelectionnerT_listParticipant_ID
@ID_LP int
AS
IF(@ID_LP IS NULL)
RAISERROR('Identifiant requis !',16,1)
ELSE
SELECT ID_LP,ID_equipe,ID_benificiaire
FROM T_listParticipant
WHERE @ID_LP=ID_LP
RETURN
GO
CREATE PROCEDURE SupprimerT_listParticipant
@ID_LP int
AS
IF(@ID_LP IS NULL)
RAISERROR('Identifiant requis !',16,1)
ELSE
DELETE FROM T_listParticipant WHERE @ID_LP=ID_LP
RETURN
GO