Views [Purchasing].[vVendorWithAddresses]
Vendor (company) names and addresses .
PropertyValue
CollationSQL_Latin1_General_CP1_CI_AS
ANSI Nulls OnTrue
Quoted Identifier OnTrue
Created13:14:55 14 marca 2012
Last Modified13:14:55 14 marca 2012
NameData TypeMax Length (Bytes)
BusinessEntityIDint4
Name[dbo].[Name]100
AddressType[dbo].[Name]100
AddressLine1nvarchar(60)120
AddressLine2nvarchar(60)120
Citynvarchar(30)60
StateProvinceName[dbo].[Name]100
PostalCodenvarchar(15)30
CountryRegionName[dbo].[Name]100

CREATE VIEW [Purchasing].[vVendorWithAddresses] AS
SELECT
   v.[BusinessEntityID]
   ,v.[Name]
   ,at.[Name] AS [AddressType]
   ,a.[AddressLine1]
   ,a.[AddressLine2]
   ,a.[City]
   ,sp.[Name] AS [StateProvinceName]
   ,a.[PostalCode]
   ,cr.[Name] AS [CountryRegionName]
FROM [Purchasing].[Vendor] v
   INNER JOIN [Person].[BusinessEntityAddress] bea
   ON bea.[BusinessEntityID] = v.[BusinessEntityID]
   INNER JOIN [Person].[Address] a
   ON a.[AddressID] = bea.[AddressID]
   INNER JOIN [Person].[StateProvince] sp
   ON sp.[StateProvinceID] = a.[StateProvinceID]
   INNER JOIN [Person].[CountryRegion] cr
   ON cr.[CountryRegionCode] = sp.[CountryRegionCode]
   INNER JOIN [Person].[AddressType] at
   ON at.[AddressTypeID] = bea.[AddressTypeID];
GO
EXEC sp_addextendedproperty N'MS_Description', N'Vendor (company) names and addresses .', 'SCHEMA', N'Purchasing', 'VIEW', N'vVendorWithAddresses', NULL, NULL
GO