x_data.Planung_Monat.sql 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. SET QUOTED_IDENTIFIER ON
  2. GO
  3. SET ANSI_NULLS ON
  4. GO
  5. CREATE VIEW [x_data].[Planung_Monat] AS
  6. SELECT [Hauptbetrieb_ID]
  7. , [Hauptbetrieb_Name]
  8. , [Standort_ID]
  9. , [Standort_Name]
  10. , [Jahr]
  11. , [Kostenstelle]
  12. , isnull([Ebene1], '') AS [Ebene1]
  13. , isnull([Ebene2], '') AS [Ebene2]
  14. , CASE
  15. WHEN [Ebene2] IN ('Verkaufsabh. Kosten', 'Direkte Fixkosten') THEN
  16. CASE
  17. WHEN [Kostenstelle] = '1' THEN '1 - NA'
  18. WHEN [Kostenstelle] = '2' THEN '2 - GA'
  19. WHEN [Kostenstelle] = '3' THEN '3 - T&Z'
  20. WHEN [Kostenstelle] = '4' THEN '4 - SC'
  21. WHEN [Kostenstelle] = '5' THEN '5 - sonst. Abt.'
  22. WHEN [Kostenstelle] = '0' THEN '0 - VW'
  23. ELSE ''
  24. END
  25. ELSE isnull([Ebene3], '') END AS [Ebene3]
  26. , isnull([Ebene4], '') AS [Ebene4]
  27. , isnull([Ebene5], '') AS [Ebene5]
  28. , [Marke]
  29. , isnull([Plan], 0.0) AS [Plan]
  30. , isnull([Wert01], 0.0) AS [Wert01]
  31. , isnull([Wert02], 0.0) AS [Wert02]
  32. , isnull([Wert03], 0.0) AS [Wert03]
  33. , isnull([Wert04], 0.0) AS [Wert04]
  34. , isnull([Wert05], 0.0) AS [Wert05]
  35. , isnull([Wert06], 0.0) AS [Wert06]
  36. , isnull([Wert07], 0.0) AS [Wert07]
  37. , isnull([Wert08], 0.0) AS [Wert08]
  38. , isnull([Wert09], 0.0) AS [Wert09]
  39. , isnull([Wert10], 0.0) AS [Wert10]
  40. , isnull([Wert11], 0.0) AS [Wert11]
  41. , isnull([Wert12], 0.0) AS [Wert12]
  42. FROM [GC_CONFIG].[ari].[Planung_Monat]
  43. GO
  44. SET QUOTED_IDENTIFIER OFF
  45. GO
  46. SET ANSI_NULLS OFF
  47. GO
  48. GO