
[dbo].[CustomerAddressInformation_XLedger]
create view [dbo].[CustomerAddressInformation_XLedger]
(
CustomerFid,
CustomerAddressId,
CustomerNumber,
AddressCode,
[Address1],
[Address2],
[Address3],
City,
[State],
PostalCode,
CountryName,
Contact,
CustomerJoinField,
CustomerAddressJoinField,
CountryCodeStandardFID
)
as
select
CustomerFid = AccountingCustomer.AccountingCustomerId,
CustomerAddressId = AccountingCustomerAddress.AccountingCustomerAddressId,
CustomerNumber = AccountingCustomer.CustomerNumber,
AddressCode = dbo.GetAccountingCustomerAddressTypeAddressCode( AccountingCustomerAddressType.TypeName ),
[Address1] = AccountingCustomerAddress.[Address1],
[Address2] = AccountingCustomerAddress.[Address2],
[Address3] = AccountingCustomerAddress.[Address3],
City = AccountingCustomerAddress.City,
[State] = AccountingCustomerAddress.[State],
PostalCode = AccountingCustomerAddress.PostalCode,
CountryName = CountryCodeStandard.VanlineCountryCode,
Contact = AccountingCustomer.Contact,
CustomerJoinField = AccountingCustomer.AccountingCustomerId,
CustomerAddressJoinField = AccountingCustomerAddress.AccountingCustomerAddressId,
CountryCodeStandardFID = AccountingCustomerAddress.CountryCodeStandardFID
from AccountingCustomer
inner join AccountingCustomerAddress on AccountingCustomerAddress.AccountingCustomerFid = AccountingCustomer.AccountingCustomerId
inner join AccountingCustomerAddressType on AccountingCustomerAddressType.AccountingCustomerAddressTypeId = AccountingCustomerAddress.AccountingCustomerAddressTypeFid
left outer join CountryCodeStandard on CountryCodeStandard.CountryCodeStandardID = AccountingCustomerAddress.CountryCodeStandardFID
GO
GRANT SELECT ON [dbo].[CustomerAddressInformation_XLedger] TO [MssExec]
GRANT INSERT ON [dbo].[CustomerAddressInformation_XLedger] TO [MssExec]
GRANT DELETE ON [dbo].[CustomerAddressInformation_XLedger] TO [MssExec]
GRANT UPDATE ON [dbo].[CustomerAddressInformation_XLedger] TO [MssExec]
GO