Kundenadressen
|
SELECT CONVERT(CONCAT((LEFT(Kunden.Kundennummer, 5)),(RIGHT(Kundenkontakt.Nummer, 2))), SQL_CHAR) AS [ID_NR], CONCAT((CONCAT(INSERT(Kunden.Kundennummer, 6, 5,SPACE(1)),(UCASE(Kunden.Kurzbezeichnung)))),(CONCAT(SPACE(1), Kundenkontakt.Name))) AS [Filename], Kundenkontakt.Name AS [FamilyName], LEFT(Kundenkontakt.Name, 0) AS [GivenName], LEFT(Kundenkontakt.Name, 0) AS [Title], LEFT(Kundenkontakt.Name, 0) AS [NamePrefix], LEFT(Kundenkontakt.Name, 0) AS [NameSuffix], LEFT(Kundenkontakt.Name, 0) AS [Nickname], LEFT(Kundenkontakt.Geburtstag, 0) AS [Birthdate], RIGHT(CONVERT(Kunden.Timestamp_Datum, SQL_CHAR), 2) AS [Day], SUBSTRING(CONVERT(Kunden.Timestamp_Datum, SQL_CHAR), 6, 2) AS [Month], LEFT(CONVERT(Kunden.Timestamp_Datum, SQL_CHAR), 4) AS [Year], Kunden.Strasse AS [Street], Kunden.Laendercode AS [State], Kunden.Postleitzahl AS [PostalCode], Kunden.Ort AS [City], LEFT(Kunden.Laendercode, 0) AS [Country], Kundenkontakt.Telefon AS [Tel], LEFT(Kundenkontakt.Telefon, 0) AS [TelHome], Kunden.Telefon AS [TelWork], Kundenkontakt.Handy AS [TelCell], LEFT(Kundenkontakt.Autotelefon, 0) AS [TelCellHome], Kundenkontakt.Autotelefon AS [TelCellWork], Kundenkontakt.Telefax AS [TelFax], LEFT(Kundenkontakt.Telefax, 0) AS [TelFaxHome], Kunden.Telefax AS [TelFaxWork], Kundenkontakt.E_Mail AS [Email], LEFT(Kundenkontakt.E_Mail, 0) AS [EmailHome], Kunden.E_Mail AS [EmailWork], Kunden.Homepage AS [Url], LEFT(Kunden.Homepage, 0) AS [UrlHome], LEFT(Kunden.Homepage, 0) AS [UrlWork], CONCAT(Kunden.Name1,CONCAT(SPACE(1), Kunden.Name2)) AS [Org], Kundenkontakt.Abteilung AS [Role], Kunden.Memo_Anker_NurText AS [MEMO], Kundenkontakt.Infofeld AS [Note], LEFT(Kunden.Strasse, 0) AS [StreetHome], LEFT(Kunden.Laendercode, 0) AS [StateHome], LEFT(Kunden.Postleitzahl, 0) AS [PostalCodeHome], LEFT(Kunden.Ort, 0) AS [CityHome], LEFT(Kunden.Laendercode, 0) AS [CountryHome], LEFT(Kunden.Strasse, 0) AS [StreetWork], LEFT(Kunden.Laendercode, 0) AS [StateWork], LEFT(Kunden.Postleitzahl, 0) AS [PostalCodeWork], LEFT(Kunden.Ort, 0) AS [CityWork], LEFT(Kunden.Laendercode, 0) AS [CountryWork] FROM Kunden AS Kunden, Kundenkontakt AS Kundenkontakt WHERE Kundenkontakt.Kundennummer = Kunden.Kundennummer AND (Kunden.Statuskennzeichen <> 'Ja') AND (Kundenkontakt.Satzart = 'A') ORDER BY Kunden.Kundennummer, Kundenkontakt.Nummer
|
Lieferantenadressen
|
SELECT CONVERT(CONCAT((LEFT(Lieferanten.Lieferantennummer, 5)),(RIGHT(Lieferantenkontakt.Nummer, 2))), SQL_CHAR) AS [ID_NR], CONCAT((CONCAT(INSERT(Lieferanten.Lieferantennummer, 6, 5,SPACE(1)),(UCASE(Lieferanten.Kurzbezeichnung)))),(CONCAT(SPACE(1), Lieferantenkontakt.Name))) AS [Filename], Lieferantenkontakt.Name AS [FamilyName], LEFT(Lieferantenkontakt.Name, 0) AS [GivenName], LEFT(Lieferantenkontakt.Name, 0) AS [Title], LEFT(Lieferantenkontakt.Name, 0) AS [NamePrefix], LEFT(Lieferantenkontakt.Name, 0) AS [NameSuffix], LEFT(Lieferantenkontakt.Name, 0) AS [Nickname], LEFT(Lieferantenkontakt.Geburtstag, 0) AS [Birthdate], RIGHT(CONVERT(Lieferanten.Timestamp_Datum, SQL_CHAR), 2) AS [Day], SUBSTRING(CONVERT(Lieferanten.Timestamp_Datum, SQL_CHAR), 6, 2) AS [Month], LEFT(CONVERT(Lieferanten.Timestamp_Datum, SQL_CHAR), 4) AS [Year], Lieferanten.Strasse AS [Street], Lieferanten.Laendercode AS [State], Lieferanten.Postleitzahl AS [PostalCode], Lieferanten.Ort AS [City], LEFT(Lieferanten.Laendercode, 0) AS [Country], Lieferantenkontakt.Telefon AS [Tel], LEFT(Lieferantenkontakt.Telefon, 0) AS [TelHome], Lieferanten.Telefon AS [TelWork], Lieferantenkontakt.Handy AS [TelCell], LEFT(Lieferantenkontakt.Autotelefon, 0) AS [TelCellHome], Lieferantenkontakt.Autotelefon AS [TelCellWork], Lieferantenkontakt.Telefax AS [TelFax], LEFT(Lieferantenkontakt.Telefax, 0) AS [TelFaxHome], Lieferanten.Telefax AS [TelFaxWork], Lieferantenkontakt.E_Mail AS [Email], LEFT(Lieferantenkontakt.E_Mail, 0) AS [EmailHome], Lieferanten.E_Mail AS [EmailWork], Lieferanten.Homepage AS [Url], LEFT(Lieferanten.Homepage, 0) AS [UrlHome], LEFT(Lieferanten.Homepage, 0) AS [UrlWork], CONCAT(Lieferanten.Name1,CONCAT(SPACE(1), Lieferanten.Name2)) AS [Org], Lieferantenkontakt.Abteilung AS [Role], Lieferanten.Memo_Anker_NurText AS [MEMO], Lieferantenkontakt.Infofeld AS [Note], LEFT(Lieferanten.Strasse, 0) AS [StreetHome], LEFT(Lieferanten.Laendercode, 0) AS [StateHome], LEFT(Lieferanten.Postleitzahl, 0) AS [PostalCodeHome], LEFT(Lieferanten.Ort, 0) AS [CityHome], LEFT(Lieferanten.Laendercode, 0) AS [CountryHome], LEFT(Lieferanten.Strasse, 0) AS [StreetWork], LEFT(Lieferanten.Laendercode, 0) AS [StateWork], LEFT(Lieferanten.Postleitzahl, 0) AS [PostalCodeWork], LEFT(Lieferanten.Ort, 0) AS [CityWork], LEFT(Lieferanten.Laendercode, 0) AS [CountryWork] FROM Lieferanten AS Lieferanten, Lieferantenkontakt AS Lieferantenkontakt WHERE Lieferantenkontakt.Lieferantennummer = Lieferanten.Lieferantennummer AND (Lieferanten.Statuskennzeichen <> 'Ja') AND (Lieferantenkontakt.Satzart = 'A') ORDER BY Lieferanten.Lieferantennummer, Lieferantenkontakt.Nummer |