View: [AdventureWorks2016CTP3].[Purchasing].[vVendorWithAddresses]

CollapseAll image

Collapse image View properties


Name  Value 
 Schema   [Purchasing] 
 Owner   [dbo] 
 Creation date   16.11.2015 
 Is schema bound   
 Encrypted   
 ID   1325247776 

Collapse image Creation options


Name Value
QUOTED_IDENTIFIER ON
ANSI_NULLS ON

Collapse image Resultset


Name  Description Data type Max length
BusinessEntityID   int 4
Name   [dbo].[Name] 50
AddressType   [dbo].[Name] 50
AddressLine1   nvarchar 60
AddressLine2   nvarchar 60
City   nvarchar 30
StateProvinceName   [dbo].[Name] 50
PostalCode   nvarchar 15
CountryRegionName   [dbo].[Name] 50
Total: 9 column(s)

Collapse image Objects that [Purchasing].[vVendorWithAddresses] depends on


Object name Object type Dep level
[Purchasing] Schema 1
[Person].[Address] Table 1
[Person].[AddressType] Table 1
[Person].[BusinessEntityAddress] Table 1
[Person].[CountryRegion] Table 1
[Person].[StateProvince] Table 1
[Purchasing].[Vendor] Table 1
Total 7 object(s)

Collapse image Extended properties


Name  Value 
MS_Description Vendor (company) names and addresses .

Collapse image SQL


SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
GO

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

Collapse image See also


List of views