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

From dbscript Online Help
Jump to: navigation, search
Line 3: Line 3:
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
|-
 
|-
| '''view
+
| '''View
 
| Purchasing.vVendor
 
| Purchasing.vVendor
 
|- valign="top"
 
|- valign="top"
Line 11: Line 11:
 
|}
 
|}
  
 +
 +
=== Source ===
 
<pre>
 
<pre>
 
CREATE VIEW [Purchasing].[vVendor] AS  
 
CREATE VIEW [Purchasing].[vVendor] AS  
Line 48: Line 50:
 
</pre>
 
</pre>
  
 
+
=== References ===
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
{| border="1" cellpadding="5" cellspacing="0" style="border-collapse:collapse"
 
|- style="background:silver"
 
|- style="background:silver"
Line 94: Line 96:
 
| Table
 
| Table
 
| [[Purchasing.VendorContact_(table)|Purchasing.VendorContact]]
 
| [[Purchasing.VendorContact_(table)|Purchasing.VendorContact]]
 +
 +
|-
 +
| Schema
 +
| Schema
 +
| [[Purchasing_(schema)|Purchasing]]
  
 
|}
 
|}
 
  
  

Revision as of 00:07, 3 February 2010

wikibot

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


Source

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];

References

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


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];


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