CREATE TABLE [import].[Sachposten] (
   [timestamp] [binary](8) NOT NULL,
   [Lfd_ Nr_] [int] NOT NULL,
   [Sachkontonr_] [varchar](20) NOT NULL,
   [Buchungsdatum] [datetime] NOT NULL,
   [Belegart] [int] NOT NULL,
   [Belegnr_] [varchar](20) NOT NULL,
   [Beschreibung] [varchar](100) NOT NULL,
   [Gegenkontonr_] [varchar](20) NOT NULL,
   [Betrag] [decimal](38,20) NOT NULL,
   [Kostenstellencode] [varchar](10) NOT NULL,
   [Markencode] [varchar](10) NOT NULL,
   [Benutzer ID] [varchar](20) NOT NULL,
   [Herkunftscode] [varchar](10) NOT NULL,
   [Systembuchung] [tinyint] NOT NULL,
   [Nachbuchung] [tinyint] NOT NULL,
   [Projektnr_] [varchar](20) NOT NULL,
   [Menge] [decimal](38,20) NOT NULL,
   [MWSt Betrag] [decimal](38,20) NOT NULL,
   [Konzernmandantencode] [varchar](10) NOT NULL,
   [Buch_-Blatt Name] [varchar](20) NOT NULL,
   [Ursachencode] [varchar](10) NOT NULL,
   [Buchungsart] [int] NOT NULL,
   [Geschäftsbuchungsgruppe] [varchar](20) NOT NULL,
   [Produktbuchungsgruppe] [varchar](20) NOT NULL,
   [Gegenkontoart] [int] NOT NULL,
   [Transaktionsnr_] [int] NOT NULL,
   [Sollbetrag] [decimal](38,20) NOT NULL,
   [Habenbetrag] [decimal](38,20) NOT NULL,
   [Belegdatum] [datetime] NOT NULL,
   [Externe Belegnummer] [varchar](30) NOT NULL,
   [Herkunftsart] [int] NOT NULL,
   [Herkunftsnr_] [varchar](20) NOT NULL,
   [Nummernserie] [varchar](10) NOT NULL,
   [Steuergebietscode] [varchar](20) NOT NULL,
   [Steuerpflichtig] [tinyint] NOT NULL,
   [Steuergruppencode] [varchar](10) NOT NULL,
   [Verbrauchssteuer] [tinyint] NOT NULL,
   [MWSt Geschäftsbuchungsgruppe] [varchar](10) NOT NULL,
   [MWSt Produktbuchungsgruppe] [varchar](10) NOT NULL,
   [Betrag (BW)] [decimal](38,20) NOT NULL,
   [Sollbetrag (BW)] [decimal](38,20) NOT NULL,
   [Habenbetrag (BW)] [decimal](38,20) NOT NULL,
   [FA-Nr_] [varchar](20) NOT NULL,
   [Anlage Postenart] [int] NOT NULL,
   [Anlagenposten Lfd_ Nr_] [int] NOT NULL,
   [Ausgleichs ID] [varchar](20) NOT NULL,
   [geschlossen] [tinyint] NOT NULL,
   [AT-USt_ Betrag] [decimal](38,20) NOT NULL,
   [Filialcode] [varchar](10) NOT NULL,
   [Hauptbereich] [int] NOT NULL,
   [Fahrgestellnummer] [varchar](20) NOT NULL,
   [Buchnummer] [varchar](20) NOT NULL,
   [Fahrzeug-Kz] [int] NOT NULL,
   [Umgebucht] [tinyint] NOT NULL,
   [Storniert] [tinyint] NOT NULL,
   [Storno für Lfd_ Nr_] [int] NOT NULL,
   [Umbuchung für Lfd_ Nr_] [int] NOT NULL,
   [Datev lfd_Exportnr_] [int] NOT NULL,
   [Alte Sachkontonr_] [varchar](20) NOT NULL,
   [Autom_Ausgleich LfdNr_] [int] NOT NULL,
   [Fahrzeugklassecode] [varchar](10) NOT NULL,
   [geschlossen am] [datetime] NOT NULL,
   [MB_Makecode] [varchar](2) NOT NULL,
   [MB_Locationcode] [varchar](2) NOT NULL,
   [MB_Costcentercode] [varchar](2) NOT NULL,
   [MB_Distributionchannelcode] [varchar](2) NOT NULL,
   [MB_Costunitcode] [varchar](2) NOT NULL,
   [MB_Taxationcode] [varchar](2) NOT NULL,
   [Value Entry No_] [int] NOT NULL,
   [BKR Fzg_-Markencode] [varchar](10) NOT NULL,
   [BKR Datenmarkencode] [varchar](10) NOT NULL,
   [Alter Kostenstellencode] [varchar](10) NOT NULL,
   [Alter Markencode] [varchar](10) NOT NULL,
   [Datev - Allready Transferred] [tinyint] NOT NULL,
   [Datev - Sales VAT Account] [varchar](20) NOT NULL,
   [Datev - Purchase VAT Account] [varchar](20) NOT NULL,
   [Datev - Reverse Chrg_ VAT Acc_] [varchar](20) NOT NULL,
   [Datev - VAT Calculation Type] [int] NOT NULL,
   [Datev - Currency Code] [varchar](10) NOT NULL,
   [Datev - Currency Factor] [decimal](38,20) NOT NULL,
   [Datev - Amount] [decimal](38,20) NOT NULL,
   [Datev - VAT Amount] [decimal](38,20) NOT NULL,
   [Datev - Document No_] [varchar](30) NOT NULL,
   [Datev - Document No_ Assigned] [tinyint] NOT NULL,
   [Datev - Imported] [tinyint] NOT NULL,
   [Datev - G_L Account No_] [varchar](20) NOT NULL,
   [Datev - Line No_] [int] NOT NULL,
   [Datev - Issue L + L] [int] NOT NULL,
   [Datev - Func_ Addition L + L] [int] NOT NULL,
   [Client_DB] [varchar](50) NOT NULL

)

CREATE NONCLUSTERED INDEX [Sachposten_Sachkontonr] ON [import].[Sachposten] ([Sachkontonr_]) INCLUDE ([Belegnr_], [Beschreibung], [Betrag], [Kostenstellencode], [Markencode], [Benutzer ID], [Fahrgestellnummer], [Buchnummer], [Client_DB])

GO
