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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
IF EXISTS
(
SELECT *
FROM AffaireServices
WHERE serviceChar='SAMPP'
AND affaireNum = @Numero_affaire
)
BEGIN
UPDATE AffaireServices
SET recuLe2 = @Date_recu_Service01b,
aConsulte = @Service01,
renvoyeLe = @Date_renvoyer_Service01,
envoyeLe = @Date_envoyer_Service01,
recuLe = @Date_recu_Service01,
preavis = ISNULL(NULLIF(@Preavis_select_Serv01, 'Veuillez choisir'), '')
WHERE serviceChar='SAMPP'
AND affaireNum = @Numero_affaire
END
ELSE
BEGIN
INSERT INTO AffaireServices
(
recuLe2,
renvoyeLe,
envoyeLe,
recuLe,
serviceChar,
affaireNum,
nom,
aConsulte,
preavis,
serviceId
)
VALUES
(
@Date_recu_Service01b,
@Date_renvoyer_Service01,
@Date_envoyer_Service01,
@Date_recu_Service01,
'SAMPP',
@Numero_affaire,
'SAMPP - Service des affaires militaires et de la protection de la population',
@Service01,
@Preavis_select_Serv01,
1
)
END |
Partager