Datev Export sqlMainData Example

This is the script, which is responsible for collection all the address data, which needs to be exported.

Available Parameters

  1. @company - If you work with multiple companies, you have to export each company by it's own.

  2. @dateFrom - Start date for the export

  3. @dateUntil - End date for the export

Example Usages

 SELECT AS Kundennummer,
       CASE WHEN adrIsCustomer = 1 THEN adr.adrDebitor ELSE adr.adrKreditor END AS Konto,
       adr.adrName AS Firmenname,
       adr.adrLastName as Nachname,
       adr.adrFirstName as Vorname,
       '' AS Anrede,
       'STR' AS Adresstyp,
       adrLoc.alocStreet AS Strasse,
       adrLoc.alocStreetNumber AS Hausnummer,
       adrLoc.alocZip AS PLZ,
       adrLoc.alocCity AS Stadt,
       adrLoc.alocAdditionalInfo AS Zusatzinformation
  FROM [dbo].[address] AS adr
  LEFT JOIN addressLocation AS adrLoc ON = adr.adrDefaultInvoiceAddress
  LEFT JOIN country AS country ON = adrLoc.alocCountryId
 WHERE adr.adrIsCustomer = 1 OR adr.adrIsSupplier = 1

Last updated