SET QUOTED_IDENTIFIER ON 
GO
SET ANSI_NULLS ON 
GO
CREATE view load.NW_GW_Bestand AS
select convert(varchar(10), Hauptbetrieb_ID)               AS Hauptbetrieb_ID,
       convert(varchar(50), Hauptbetrieb_Name)             AS Hauptbetrieb_Name,
       convert(varchar(10), Standort_ID)                   AS Standort_ID,
       convert(varchar(50), Standort_Name)                 AS Standort_Name,
       convert(varchar(100), Fabrikat)                     AS Fabrikat,
       convert(varchar(255), Modell_Beschreibung)          AS Modell_Beschreibung,
       convert(varchar(50), Model)                         AS Model,
       convert(varchar(300), FZG)                          AS FZG,
       convert(varchar(20), Fahrzeugart)                   AS Fahrzeugart,
       convert(varchar(20), Fahrzeugtyp)                   AS Fahrzeugtyp,
       convert(varchar(20), Fahrzeugtyp_1)                 AS Fahrzeugtyp_1,
       convert(varchar(20), Standtagestaffel)              AS Standtagestaffel,
       convert(varchar(100), Farbe)                        AS Farbe,
       convert(varchar(50), Standort_1)                    AS Standort_1,
       convert(varchar(100), Lieferant_Einkäufer)          AS [Lieferant/Einkäufer],
       convert(varchar(100), Name_Lieferant)               AS Name_Lieferant,
       convert(varchar(100), Name_Einkäufer)               AS Name_Einkäufer,
       convert(varchar(100), FZG_Einkäufer)                AS FZG_Einkäufer,
       convert(varchar(50), EZ)                            AS EZ,
       convert(int, Km_stand)                              AS [Km-stand],
       convert(int, Menge)                                 AS Menge,
       convert(decimal(28, 8), Einsatz)                    AS Einsatz,
       convert(int, int__Aufw_)                            AS [int. Aufw.],
       convert(int, Standtage)                             AS Standtage,
       convert(int, Plan_VK_Netz_brutto)                   AS [Plan VK Netz brutto],
       convert(int, Plan_VK_Netz_netto)                    AS [Plan VK Netz netto],
       convert(int, Plan_Vk_Platz_brutto)                  AS [Plan Vk Platz brutto],
       convert(int, Plan_VK_Platz_netto)                   AS [Plan VK Platz netto],
       convert(int, Einsatz_ori__Betrag_FIBU_)             AS [Einsatz_ori (Betrag FIBU)],
       convert(int, Einsatz_ber)                           AS [Einsatz ber],
       convert(datetime, Invoice_Date)                     AS [Invoice Date],
       convert(int, Fabrikat_Order_By)                     AS Fabrikat_Order_By,
       convert(int, Standtage_ER)                          AS [Standtage ER],
       convert(date, Auslief__Datum_gepl_)                 AS [Auslief.-Datum gepl.],
       convert(varchar(100), Kunde)                        AS Kunde,
       convert(varchar(20), Standort_Nr_AB)                AS Standort_Nr_AB,
       convert(varchar(100), Verkäufer)                    AS Verkäufer,
       convert(varchar(20), Auslief_Datum_Zeichen)         AS Auslief_Datum_Zeichen,
       convert(varchar(50), Standort_Name_Auftragsbestand) AS Standort_Name_Auftragsbestand,
       convert(varchar(10), AB_ja_nein)                    AS [AB ja_nein],
       convert(varchar(200), FZG_AB)                       AS FZG_AB,
       convert(varchar(100), Vehicle_Reference_berechnet)  AS Vehicle_Reference_berechnet,
       convert(int, Posted_Value)                          AS [Posted Value],
       convert(int, Erlös_FZG)                             AS [Erlös FZG],
       convert(int, Tage_bis_Auslief_)                     AS [Tage bis Auslief.]
from transform.NW_GW_Bestand
GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS OFF 
GO

GO
