IF EXISTS (SELECT 1 FROM SYS.VIEWS WHERE NAME='LD0VAA0SurveyAdditionalData')
BEGIN
DROP VIEW LD0VAA0SurveyAdditionalData
END
;
CREATE VIEW LD0VAA0SurveyAdditionalData
AS
SELECT
U27.KORKORT
,U27.KORKORTA
,U27.KORKORTB
,U27.KORKORTC
,U27.KORKORTD
,U27.KORKORTE
,U27.OVRFORD1
,U27.OVRFORD2
,U27.OVRFORD3
,U27.UPDDAT
,U27.UPDSIGN
,U27.KORKORTA1
,U27.KORKORTBE
,U27.KORKORTCE
,U27.KORKORTDE
,U27.UTLANDSKT
,U27.GILTIGTTOM
,U27.KORKORTAM
,U27.KORKORTA2
,U27.KORKORTB96
,U27.KORKORTC1
,U27.KORKORTC1E
,U27.KORKORTD1
,U27.KORKORTD1E
,U27.KARTLAGGNR
,Q1.KLARTEXT as OVRFORD1_T
,Q2.KLARTEXT as OVRFORD2_T
,Q3.KLARTEXT as OVRFORD3_T
,Q4.KLARTEXT as ERSATTNTYP_T
FROM LD0P0U27 U27
LEFT OUTER JOIN ld0v0q01 AS Q1 ON Q1.KODTYP = 'LNFORDON' and Q1.KOD = U27.OVRFORD1
LEFT OUTER JOIN ld0v0q01 AS Q2 ON Q2.KODTYP = 'LNFORDON' and Q2.KOD = U27.OVRFORD2
LEFT OUTER JOIN ld0v0q01 AS Q3 ON Q3.KODTYP = 'LNFORDON' and Q3.KOD = U27.OVRFORD3
LEFT OUTER JOIN ld0v0q01 AS Q4 ON Q4.KODTYP = 'LNERSTYP' and Q4.KOD = U27.ERSATTNTYP
;