ProjetThe/ProjetTheAlone/Model/P_T_listPlat.sql

51 lines
1.2 KiB
MySQL
Raw Normal View History

2019-01-18 13:08:55 +01:00
CREATE PROCEDURE AjouterT_listPlat
@ID_listPlat int OUTPUT,
@ID_repa int,
@ID_plat int
AS
INSERT INTO T_listPlat(ID_repa,ID_plat)
VALUES(@ID_repa,@ID_plat)
SET @ID_listPlat=@@IDENTITY
RETURN
GO
CREATE PROCEDURE ModifierT_listPlat
@ID_listPlat int,
@ID_repa int,
@ID_plat int
AS
IF(@ID_listPlat IS NULL OR @ID_listPlat=0)
RAISERROR('Identifiant requis !',16,1)
ELSE UPDATE T_listPlat
SET ID_repa=@ID_repa,ID_plat=@ID_plat
WHERE ID_listPlat=@ID_listPlat
RETURN
GO
CREATE PROCEDURE SelectionnerT_listPlat
@Index VARCHAR(10)
AS
IF(@Index='ID_repa') SELECT * FROM T_listPlat ORDER BY ID_repa
ELSE IF(@Index='ID_plat') SELECT * FROM T_listPlat ORDER BY ID_plat
ELSE SELECT * FROM T_listPlat ORDER BY ID_listPlat
RETURN
GO
CREATE PROCEDURE SelectionnerT_listPlat_ID
@ID_listPlat int
AS
IF(@ID_listPlat IS NULL)
RAISERROR('Identifiant requis !',16,1)
ELSE
SELECT ID_listPlat,ID_repa,ID_plat
FROM T_listPlat
WHERE @ID_listPlat=ID_listPlat
RETURN
GO
CREATE PROCEDURE SupprimerT_listPlat
@ID_listPlat int
AS
IF(@ID_listPlat IS NULL)
RAISERROR('Identifiant requis !',16,1)
ELSE
DELETE FROM T_listPlat WHERE @ID_listPlat=ID_listPlat
RETURN
GO