[dbo].[InternationalCustomsAgentAddresses]
SET QUOTED_IDENTIFIER OFF
GO
CREATE view [dbo].[InternationalCustomsAgentAddresses]
(
InternationalCustomsAgentFID,
Address,
City,
State,
CountryCodeStandardFID,
PostalCode
)
as
select
InternationalCustomsAgentFID = InternationalCustomsAgent.InternationalCustomsAgentID,
Address = dbo.BuildAddressFromAddressParts
(
InternationalCustomsAgentAddress.Address1,
InternationalCustomsAgentAddress.Address2,
InternationalCustomsAgentAddress.Address3
),
City = InternationalCustomsAgentAddress.City,
State = InternationalCustomsAgentAddress.State,
CountryCodeStandardFID = InternationalCustomsAgentAddress.CountryCodeStandardFID,
PostalCode = InternationalCustomsAgentAddress.PostalCode
from InternationalCustomsAgent
left outer join AddressType on AddressType.TypeName = 'Main'
left outer join InternationalCustomsAgentAddress on
(
InternationalCustomsAgent.InternationalCustomsAgentID = InternationalCustomsAgentAddress.InternationalCustomsAgentFID and
AddressType.AddressTypeID = InternationalCustomsAgentAddress.AddressTypeFID
)
GO
GRANT SELECT ON [dbo].[InternationalCustomsAgentAddresses] TO [MssExec]
GRANT INSERT ON [dbo].[InternationalCustomsAgentAddresses] TO [MssExec]
GRANT DELETE ON [dbo].[InternationalCustomsAgentAddresses] TO [MssExec]
GRANT UPDATE ON [dbo].[InternationalCustomsAgentAddresses] TO [MssExec]
GO