
/****** Object:  View [dbo].[ApiCustomerLocationsView]    Script Date: 13.09.2021 14:17:15 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO


CREATE VIEW [dbo].[ApiCustomerLocationsView] as
select Knt_KntId Id, Knt_KntId CustLocId ,Knt_KntId ErpId,  odb.Odb_KntOdbID CustId , odb.Odb_KntOdbID CustCustId ,0 OwnerId, 0 OwnerCustId,
RTRIM(Knt_Nazwa1 + ' '+ Knt_Nazwa2 + ' '+ Knt_Nazwa3) Name, Knt_Kod Code,
Knt_KodPocztowy AdrrZip , Knt_Miasto AdrrCity, Knt_Ulica AdrrStreet , Knt_NrDomu AdrrNumber,  Knt_NrLokalu AdrrAppNumber, Knt_Kraj AdrrCountry,
Knt_Telefon1 Phone, Knt_Telefon2 Phone2, Knt_Email Email, Knt_Opis Notes, 
 0 as VendorId,  cast( 0 as float) geolat,cast( 0 as float) geolong, 
 '' WWW, 0 Status, CURRENT_TIMESTAMP TS, 0 SaveTS, '' DeviceUid, 0 State

from CDN.Kontrahenci k 
JOIN CDN.KntOdbiorcy odb ON odb.Odb_OdbKntID = k.Knt_KntId
GO


