DROP VIEW LD0V0WELFAREDOCUMENTDETAILS
;
CREATE VIEW LD0V0WELFAREDOCUMENTDETAILS AS
SELECT	CONVERT(VARCHAR,PD.ModifyDate,101) MODIFYDATE,
		PD.DOCUMENTTYPEDESCRIPTION, 
		PD.CASEWORKERID,
		PMD.ID METADATAID,
		PMD.PROCESSID, 
		P.NAME PROCESSNAME,
		PER.KUNDNUMMER PERSONKEY,
		PER.PNR PERSONID,
		PER.NAMN APPLICANTNAME,
		PMD.OBJECTID,
		PMD.OBJECTTYPE		
FROM LD0V0PROCESSMETADATA PMD
JOIN LD0V0PROCESSDOCUMENTS PD ON PMD.ID = PD.METADATAID
JOIN LD0V0PROCESS P ON P.Id = PMD.PROCESSID
JOIN LD0V0A PER ON PER.kundnummer = PMD.PERSONKEY
;