Northwind Database (Document! X Sample)
AdventureWorks Database / Sales Schema / Sales.CountryRegionCurrency Table
In This Topic
    Sales.CountryRegionCurrency Table
    In This Topic
    Description
    Cross-reference table mapping ISO currency codes to a country or region.
    Properties
    Creation Date27/10/2017 14:33
    File GroupPRIMARY
    Text File Group
    System Object
    Published for Replication
    Rows109
    Data Space Used8.00 KB
    Index Space Used24.00 KB
    Columns
     Column NameDescriptionDatatypeLengthAllow NullsDefaultFormula
    Primary Key ISO code for countries and regions. Foreign key to CountryRegion.CountryRegionCode.VarWChar3   
    Primary Key ISO standard currency code. Foreign key to Currency.CurrencyCode.WChar3   
     Date and time the record was last updated.DBTimeStamp4 
    (getdate())
     
    Indexes
    IndexDescriptionPrimaryUnique
    Nonclustered index.  
    Primary key (clustered) constraint
    Relationships
    RelationshipDescription
    Foreign key constraint referencing CountryRegion.CountryRegionCode.
    Foreign key constraint referencing Currency.CurrencyCode.
    Objects that Sales.CountryRegionCurrency depends on
     Database ObjectObject TypeDescriptionDep Level
    Person.CountryRegion tablePerson.CountryRegionTableLookup table containing the ISO standard codes for countries and regions.4
    Sales.Currency tableSales.CurrencyTableLookup table containing standard ISO currencies.3
    dbo.Name datatypedbo.NameUser Defined Data Type 2
    SQL
    SET ANSI_NULLS ON
    SET QUOTED_IDENTIFIER ON
    CREATE TABLE [Sales].[CountryRegionCurrency](
        [CountryRegionCode] [nvarchar](3) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
        [CurrencyCode] [nchar](3) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
        [ModifiedDate] [datetime] NOT NULL,
     CONSTRAINT [PK_CountryRegionCurrency_CountryRegionCode_CurrencyCode] PRIMARY KEY CLUSTERED 
    (
        [CountryRegionCode] ASC,
        [CurrencyCode] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    ALTER TABLE [Sales].[CountryRegionCurrency] ADD  CONSTRAINT [DF_CountryRegionCurrency_ModifiedDate]  DEFAULT (getdate()) FOR [ModifiedDate]
    ALTER TABLE [Sales].[CountryRegionCurrency]  WITH CHECK ADD  CONSTRAINT [FK_CountryRegionCurrency_CountryRegion_CountryRegionCode] FOREIGN KEY([CountryRegionCode])
    REFERENCES [Person].[CountryRegion] ([CountryRegionCode])
    ALTER TABLE [Sales].[CountryRegionCurrency] CHECK CONSTRAINT [FK_CountryRegionCurrency_CountryRegion_CountryRegionCode]
    ALTER TABLE [Sales].[CountryRegionCurrency]  WITH CHECK ADD  CONSTRAINT [FK_CountryRegionCurrency_Currency_CurrencyCode] FOREIGN KEY([CurrencyCode])
    REFERENCES [Sales].[Currency] ([CurrencyCode])
    ALTER TABLE [Sales].[CountryRegionCurrency] CHECK CONSTRAINT [FK_CountryRegionCurrency_Currency_CurrencyCode]
    See Also