Difference between revisions of "Purchasing.vVendor (view)"

From dbscript Online Help
Jump to: navigation, search
Line 44: Line 44:
 
     ON cr.[CountryRegionCode] = sp.[CountryRegionCode];
 
     ON cr.[CountryRegionCode] = sp.[CountryRegionCode];
 
</pre>
 
</pre>
 
 
== automatically generated ==
 
== automatically generated ==
  
Line 51: Line 50:
 
| '''view
 
| '''view
 
| Purchasing.vVendor
 
| Purchasing.vVendor
|-
+
|- valign="top"
  
 
| '''Description
 
| '''Description
Line 103: Line 102:
 
| '''Object Type
 
| '''Object Type
 
| '''Dependency Type
 
| '''Dependency Type
+
 
 
|-
 
|-
 
| [[Person.Address_(table)|Person.Address]]
 
| [[Person.Address_(table)|Person.Address]]
Line 136: Line 135:
 
| Table
 
| Table
 
| Select
 
| Select
 +
|-
 +
| [[.Purchasing_(schema)|.Purchasing]]
 +
| Schema
 +
| Schema
 
|}
 
|}

Revision as of 07:26, 30 November 2009

wikibot

view Purchasing.vVendor
CREATE VIEW [Purchasing].[vVendor] AS 
SELECT 
    v.[VendorID]
    ,v.[Name]
    ,ct.[Name] AS [ContactType]
    ,c.[Title]
    ,c.[FirstName]
    ,c.[MiddleName]
    ,c.[LastName]
    ,c.[Suffix]
    ,c.[Phone]
    ,c.[EmailAddress]
    ,c.[EmailPromotion]
    ,a.[AddressLine1]
    ,a.[AddressLine2]
    ,a.[City]
    ,[StateProvinceName] = sp.[Name]
    ,a.[PostalCode]
    ,[CountryRegionName] = cr.[Name]
FROM [Purchasing].[Vendor] v
    INNER JOIN [Purchasing].[VendorContact] vc 
    ON vc.[VendorID] = v.[VendorID]
    INNER JOIN [Person].[Contact] c 
    ON c.[ContactID] = vc.[ContactID]
    INNER JOIN [Person].[ContactType] ct 
    ON vc.[ContactTypeID] = ct.[ContactTypeID]
    INNER JOIN [Purchasing].[VendorAddress] va 
    ON va.[VendorID] = v.[VendorID]
    INNER JOIN [Person].[Address] a 
    ON a.[AddressID] = va.[AddressID]
    INNER JOIN [Person].[StateProvince] sp 
    ON sp.[StateProvinceID] = a.[StateProvinceID]
    INNER JOIN [Person].[CountryRegion] cr 
    ON cr.[CountryRegionCode] = sp.[CountryRegionCode];

automatically generated

view Purchasing.vVendor
Description Vendor (company) names and addresses and the names of vendor employees to contact.

CREATE VIEW [Purchasing].[vVendor] AS 
SELECT 
    v.[VendorID]
    ,v.[Name]
    ,ct.[Name] AS [ContactType]
    ,c.[Title]
    ,c.[FirstName]
    ,c.[MiddleName]
    ,c.[LastName]
    ,c.[Suffix]
    ,c.[Phone]
    ,c.[EmailAddress]
    ,c.[EmailPromotion]
    ,a.[AddressLine1]
    ,a.[AddressLine2]
    ,a.[City]
    ,[StateProvinceName] = sp.[Name]
    ,a.[PostalCode]
    ,[CountryRegionName] = cr.[Name]
FROM [Purchasing].[Vendor] v
    INNER JOIN [Purchasing].[VendorContact] vc 
    ON vc.[VendorID] = v.[VendorID]
    INNER JOIN [Person].[Contact] c 
    ON c.[ContactID] = vc.[ContactID]
    INNER JOIN [Person].[ContactType] ct 
    ON vc.[ContactTypeID] = ct.[ContactTypeID]
    INNER JOIN [Purchasing].[VendorAddress] va 
    ON va.[VendorID] = v.[VendorID]
    INNER JOIN [Person].[Address] a 
    ON a.[AddressID] = va.[AddressID]
    INNER JOIN [Person].[StateProvince] sp 
    ON sp.[StateProvinceID] = a.[StateProvinceID]
    INNER JOIN [Person].[CountryRegion] cr 
    ON cr.[CountryRegionCode] = sp.[CountryRegionCode];


Referenced Object Object Type Dependency Type
Person.Address Table Select
Person.Contact Table Select
Person.ContactType Table Select
Person.CountryRegion Table Select
Person.StateProvince Table Select
Purchasing.Vendor Table Select
Purchasing.VendorAddress Table Select
Purchasing.VendorContact Table Select
.Purchasing Schema Schema