1 2 3 4 5 6 7 8 9 10 11 12 13
| INSERT INTO Pivot.dbo.dlHeppnerFiles
SELECT DISTINCT Ligne
,SUBSTRING(ligne,1,6) AS NumCEGID
,CONVERT(datetime,(SUBSTRING(Ligne,38,6)),103) AS DateStatut
,SUBSTRING(ligne,44,3) AS SIT
,SUBSTRING(ligne,47,3) AS JUS
, CASE WHEN (SUBSTRING(ligne,44,3) + '' + SUBSTRING(ligne,47,3)) = (SIT +''+ JUS) THEN Libelle_fr END --Colonne définissant le libelle du code à retourner
,GETDATE()
,DateModif=NULL
,DateTrsCRM=NULL
FROM #ImportHeppner
inner JOIN [Pivot].[dbo].[dlCodeHeppner] as CH on SUBSTRING(#ImportHeppner.Ligne,44,3)=CH.SIT
WHERE @LigneFichier = Ligne AND SUBSTRING(ligne,1,6) LIKE '2%' OR SUBSTRING(ligne,1,6) LIKE '1%' |
Partager