Northwind Database (Document! X Sample)
AdventureWorks Database / Person Schema / Person.vStateProvinceCountryRegion View
In This Topic
    Person.vStateProvinceCountryRegion View
    In This Topic
    Description
    Joins StateProvince table with CountryRegion table.
    Properties
    Creation Date27/10/2017 14:33
    Is Schema Bound
    Encrypted
    Ansi Nulls
    Columns
     Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
      Integer4   
      WChar3   
      dbo.Flag1   
      dbo.Name50   
      Integer4   
      VarWChar3   
      dbo.Name50   
    Objects that Person.vStateProvinceCountryRegion depends on
     Database ObjectObject TypeDescriptionDep Level
    Person.CountryRegion tablePerson.CountryRegionTableLookup table containing the ISO standard codes for countries and regions.4
    dbo.Flag datatypedbo.FlagUser Defined Data Type 4
    dbo.Name datatypedbo.NameUser Defined Data Type 2
    Sales.SalesTerritory tableSales.SalesTerritoryTableSales territory lookup table.3
    Person.StateProvince tablePerson.StateProvinceTableState and province lookup table.1
    View Definition
    CREATE VIEW [Person].[vStateProvinceCountryRegion] 
    WITH SCHEMABINDING 
    AS 
    
    SELECT 
        sp.[StateProvinceID] 
        ,sp.[StateProvinceCode] 
        ,sp.[IsOnlyStateProvinceFlag] 
        ,sp.[Name] AS [StateProvinceName] 
        ,sp.[TerritoryID] 
        ,cr.[CountryRegionCode] 
        ,cr.[Name] AS [CountryRegionName]
    FROM [Person].[StateProvince] sp 
        INNER JOIN [Person].[CountryRegion] cr 
        ON sp.[CountryRegionCode] = cr.[CountryRegionCode];
    
    See Also