IF EXISTS (SELECT 1 FROM SYS.VIEWS WHERE NAME='LD0V1LCSERVICEOVERVIEWPROCESSES')
BEGIN
DROP VIEW LD0V1LCSERVICEOVERVIEWPROCESSES
END
;
CREATE VIEW LD0V1LCSERVICEOVERVIEWPROCESSES AS     
SELECT P.PROCESSOWNERTYPE AS OWNERTYPE, P.PROCESSTYPEOID, P.NAME AS PROCESSNAME, LD.NAMN AS CASEWORKERNAME, O.NAMN AS CASEWORKERORGANIZATIONNAME,
K.VALUE AS PROCESSTYPETEXT, S.INSTYP_T AS EFFICASERVICETYPETEXT,
M.*
FROM LD0P0PROCESSMETADATA M  
LEFT JOIN LD0V0PROCESS P  ON M.PROCESSID = P.ID
LEFT OUTER JOIN LD0V0I LD ON M.CASEWORKERID = LD.HAND
LEFT OUTER JOIN LD0V0J01 O ON M.ORGANIZATIONID = O.ORGID AND M.CASEWORKERORGUNITID = O.ORGENHNR
LEFT JOIN LD0V0CCASEWORKERSERVICES S ON M.OWNERID = S.INSNR
LEFT JOIN LD0V0KANTA K  ON P.PROCESSTYPEOID = K.[VERSION] + '.' + K.ORG_OID
;
