1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
|
CREATE PROCEDURE getKeysSearch(@etage int, @statut int, @order varchar) AS
IF @PARAM = "..."
BEGIN
SELECT k.keyDoor, k.keyID, k.keyBaril, k.keyAvailable, k.keyDate, k.keyStatus,
k.keyComment, k.empID
FROM keys AS k
WHERE(keyFloor LIKE @etage) AND
((@statut = 1 AND keyAvailable = 'Libre') OR
(@statut = 2 AND keyAvailable = 'Emprunté') OR
(@statut = 3 AND keyAvailable = 'Ne pas émettre') OR
(@statut = 0 ))
ORDER BY 1
ELSE
SELECT k.keyBaril, k.keyDoor, k.keyID, k.keyAvailable, k.keyDate, k.keyStatus,
k.keyComment, k.empID
FROM keys AS k
WHERE(keyFloor LIKE @etage) AND
((@statut = 1 AND keyAvailable = 'Libre') OR
(@statut = 2 AND keyAvailable = 'Emprunté') OR
(@statut = 3 AND keyAvailable = 'Ne pas émettre') OR
(@statut = 0 ))
ORDER BY 1
END
GO |
Partager