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
| Alter PROCEDURE [dbo].[FORMULAIRE_InsertFromCleFormulaireBaseCleSituation]
@CleFormulaireBase uniqueidentifier,
@CleSituation uniqueidentifier
AS
BEGIN
insert into FORMULAIRE
(Cle, CleSituation,CleEntetePage,ClePiedPage, strNom, strRole, strDescription, xmlFormulaire, blnActif,imgApercu,intFavoris,strPath,blnModifiable,intMajor,intMinor,CleFormulaireBase)
OUTPUT Inserted.Cle
select newId(), @CleSituation,
case when FORMULAIREBASE.CleEnTetePage is null then null --pas d'entete, ne rien faire
when entetePageForm.Cle is null then newID() --Creation formulaireEntete
else entetePageForm.Cle --ajout du formulaire entete existant
end,
case when FORMULAIREBASE.ClePiedPage is null then null --pas de pied de page, ne rien faire
when PiedPageForm.Cle is null then (EXEC [dbo].[FORMULAIRE_InsertFromCleFormulaireBaseCleSituation] @CleFormulaireBase=FORMULAIREBASE.ClePiedPage, @CleSituation='D8C67176-17AA-4679-92E1-D15E7E06EF18') --Creation formulairePied
else PiedPageForm.Cle --ajout du formulaire pied de page existant
end,
FORMULAIREBASE.strNom, FORMULAIREBASE.strRole, FORMULAIREBASE.strDescription, FORMULAIREBASE.xmlFormulaire,
1,FORMULAIREBASE.imgApercu, 0,FORMULAIREBASE.strPath,FORMULAIREBASE.blnModifiable,FORMULAIREBASE.intMajor,0, FORMULAIREBASE.Cle
from FORMULAIREBASE
left outer join Formulaire as entetePageForm on entetePageForm.CleFormulaireBase = FORMULAIREBASE.CleEnTetePage and entetePageForm.cleSituation = @CleSituation
left outer join Formulaire as PiedPageForm on PiedPageForm.CleFormulaireBase = FORMULAIREBASE.ClePiedPage and PiedPageForm.cleSituation = @CleSituation
where FORMULAIREBASE.cle = @CleFormulaireBase
END |
Partager