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
| MERGE TP_traitement_gapp as TARGET USING
(
SELECT [Société],[Région],[N° Site],[Nom Site],[Identifiant intervention],[Gamme intervention],[Description de l'intervention],[Identifiant tâche],
[Description],[Etat administratif intervention],[Date début prévu tâche],[Date fin prévu tâche],[Detrompeur],[Entité demandeur],[Infos Demandeur],
[Indicateur accompagnement],[Code Journalier],[Coupure],[Société Intervenant],[Nom - prénom intervenant],[GSM Intervenant],[Mail Intervenant],[Validé ?],[Accompagnement ?],[Observation ?],[Accès],[Contrainte de sécurité],[V_Couleur],[Caractéristiques de l'intervention],[CO_ACTIVITE],[Sensibilité du site],
[Approbation automatique AS],[Etat],[Commentaire],[PermisFeu],[DateMaj],[Chef de projet SFR],[Date création intervention (hs)],[Délai],[Sites TDf],[Clés ND],
[Position Trousseau dans Armoire],[Chargé GAPP],[GénéFichierMajODEON],[Identifiant demande],[Délai Prévenance],[Sites PCTTO],[PlanPrevention],[Appartenance]
FROM TempDatatable) as SOURCE ON
TARGET.[identifiant intervention] = SOURCE.[identifiant intervention]
AND TARGET.[identifiant tâche] = SOURCE.[identifiant tâche]
AND TARGET.[Nom - prénom intervenant] = SOURCE.[Nom - prénom intervenant]
WHEN MATCHED THEN UPDATE SET TARGET.[Société] = SOURCE.[Société],
TARGET.[Région] = SOURCE.[Région],TARGET.[N° Site] = SOURCE.[N° Site],
TARGET.[Nom Site] = SOURCE.[Nom Site],TARGET.[Identifiant intervention] = SOURCE.[Identifiant intervention],
TARGET.[Gamme intervention] = SOURCE.[Gamme intervention],TARGET.[Description de l'intervention] = SOURCE.[Description de l'intervention],
TARGET.[Identifiant tâche] = SOURCE.[Identifiant tâche],TARGET.[Description] = SOURCE.[Description],
TARGET.[Etat administratif intervention] = SOURCE.[Etat administratif intervention],
TARGET.[Date début prévu tâche] = SOURCE.[Date début prévu tâche],
TARGET.[Date fin prévu tâche] = SOURCE.[Date fin prévu tâche],TARGET.[Detrompeur] = SOURCE.[Detrompeur],
TARGET.[Entité demandeur] = SOURCE.[Entité demandeur],TARGET.[Infos Demandeur] = SOURCE.[Infos Demandeur],
TARGET.[Indicateur accompagnement] = SOURCE.[Indicateur accompagnement],TARGET.[Code Journalier] = SOURCE.[Code Journalier],
TARGET.[Coupure] = SOURCE.[Coupure],TARGET.[Société Intervenant] = SOURCE.[Société Intervenant],TARGET.[Nom - prénom intervenant] = SOURCE.[Nom - prénom intervenant],
TARGET.[GSM Intervenant] = SOURCE.[GSM Intervenant],TARGET.[Mail Intervenant] = SOURCE.[Mail Intervenant],
TARGET.[Validé ?] = SOURCE.[Validé ?],TARGET.[Accompagnement ?] = SOURCE.[Accompagnement ?],TARGET.[Observation ?] = SOURCE.[Observation ?],TARGET.[Accès] = SOURCE.[Accès],
TARGET.[Contrainte de sécurité] = SOURCE.[Contrainte de sécurité],TARGET.[V_Couleur] = SOURCE.[V_Couleur],
TARGET.[Caractéristiques de l'intervention] = SOURCE.[Caractéristiques de l'intervention],TARGET.[CO_ACTIVITE] = SOURCE.[CO_ACTIVITE],
TARGET.[Sensibilité du site] = SOURCE.[Sensibilité du site],TARGET.[Approbation automatique AS] = SOURCE.[Approbation automatique AS],
TARGET.[Etat] = SOURCE.[Etat],TARGET.[Commentaire] = SOURCE.[Commentaire],TARGET.[PermisFeu] = SOURCE.[PermisFeu],TARGET.[DateMaj] = SOURCE.[DateMaj],
TARGET.[Chef de projet SFR] = SOURCE.[Chef de projet SFR],TARGET.[Date création intervention (hs)] = SOURCE.[Date création intervention (hs)],
TARGET.[Délai] = SOURCE.[Délai],TARGET.[Sites TDf] = SOURCE.[Sites TDf],TARGET.[Clés ND] = SOURCE.[Clés ND],
TARGET.[Position Trousseau dans Armoire] = SOURCE.[Position Trousseau dans Armoire],TARGET.[Chargé GAPP] = SOURCE.[Chargé GAPP],
TARGET.[GénéFichierMajODEON] = SOURCE.[GénéFichierMajODEON],TARGET.[Identifiant demande] = SOURCE.[Identifiant demande],TARGET.[Délai Prévenance] = SOURCE.[Délai Prévenance],
TARGET.[Sites PCTTO] = SOURCE.[Sites PCTTO],TARGET.[PlanPrevention] = SOURCE.[PlanPrevention],TARGET.[Appartenance] = SOURCE.[Appartenance]
WHEN NOT MATCHED
THEN INSERT ([Société],[Région],[N° Site],[Nom Site],[Identifiant intervention],[Gamme intervention],[Description de l'intervention],[Identifiant tâche],[Description],[Etat administratif intervention],[Date début prévu tâche],[Date fin prévu tâche],[Detrompeur],[Entité demandeur],[Infos Demandeur],[Indicateur accompagnement],[Code Journalier],[Coupure],[Société Intervenant],[Nom - prénom intervenant],[GSM Intervenant],[Mail Intervenant],[Validé ?],[Accompagnement ?],[Observation ?],[Accès],[Contrainte de sécurité],[V_Couleur],[Caractéristiques de l'intervention],[CO_ACTIVITE],[Sensibilité du site],[Approbation automatique AS],[Etat],[Commentaire],[PermisFeu],[DateMaj],[Chef de projet SFR],[Date création intervention (hs)],[Délai],[Sites TDf],[Clés ND],[Position Trousseau dans Armoire],[Chargé GAPP],[GénéFichierMajODEON],[Identifiant demande],[Délai Prévenance],[Sites PCTTO],[PlanPrevention],[Appartenance]) VALUES (SOURCE.[Société],SOURCE.[Région],SOURCE.[N° Site],SOURCE.[Nom Site],SOURCE.[Identifiant intervention],SOURCE.[Gamme intervention],SOURCE.[Description de l'intervention],SOURCE.[Identifiant tâche],SOURCE.[Description],SOURCE.[Etat administratif intervention],SOURCE.[Date début prévu tâche],SOURCE.[Date fin prévu tâche],SOURCE.[Detrompeur],SOURCE.[Entité demandeur],SOURCE.[Infos Demandeur],SOURCE.[Indicateur accompagnement],SOURCE.[Code Journalier],SOURCE.[Coupure],SOURCE.[Société Intervenant],SOURCE.[Nom - prénom intervenant],SOURCE.[GSM Intervenant],SOURCE.[Mail Intervenant],SOURCE.[Validé ?],SOURCE.[Accompagnement ?],SOURCE.[Observation ?],SOURCE.[Accès],SOURCE.[Contrainte de sécurité],SOURCE.[V_Couleur],SOURCE.[Caractéristiques de l'intervention],SOURCE.[CO_ACTIVITE],SOURCE.[Sensibilité du site],SOURCE.[Approbation automatique AS],SOURCE.[Etat],SOURCE.[Commentaire],SOURCE.[PermisFeu],SOURCE.[DateMaj],SOURCE.[Chef de projet SFR],SOURCE.[Date création intervention (hs)],SOURCE.[Délai],SOURCE.[Sites TDf],SOURCE.[Clés ND],SOURCE.[Position Trousseau dans Armoire],SOURCE.[Chargé GAPP],SOURCE.[GénéFichierMajODEON],SOURCE.[Identifiant demande],SOURCE.[Délai Prévenance],SOURCE.[Sites PCTTO],SOURCE.[PlanPrevention],SOURCE.[Appartenance]); |
Partager