IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[V_MODULE_LIST_UEREL]'))
	DROP VIEW [dbo].[V_MODULE_LIST_UEREL]
GO
CREATE VIEW [dbo].[V_MODULE_LIST_UEREL] ([ROLLE], [ARBEITSGEBIET], [MODULE]) AS 
  SELECT DISTINCT DT510.DI010320 Rolle, DT513.DI010324 Arbeitsgebiet, DT405.DI000123 Module FROM DT405 -- Rollen und Arbeitsgebiete - Hauptmodule
    JOIN DT515 ON (DT515.DI010327=DT405.DI000123)
    JOIN DT513 ON (DT515.DI010325 = DT513.DI010324)
    JOIN DT512 ON (DT513.DI010324 = DT512.DI010332)
	  JOIN DT510 ON (DT512.DI010333 = DT510.DI010320)
    WHERE DT513.DI057799 = 1
    AND LEN(DI000123) = 6;
GO
