Database Reference
In-Depth Information
2.
Decide on a method for creating the DimDates table, and begin creating them
utilizing the design represented in both Listing 5-10 and Figure 5-30 .
Figure 5-30. The DimDates table
3.
If you are typing the SQL code, highlight and execute the code by clicking the
“! Execute” button. If you choose to use the table designer or the diagramming tool,
make sure you use the Save button to create the tables in the database.
adding Foreign Key constraints
We have added a new table to the data warehouse database, but now we want to connect this new table to
the existing ones using foreign key constraints.
1.
Add the foreign key constraints to the DimDates table using the code in Listing 5-12.
Listing 5-12. Creating the DWPubsSales Foreign Key Constraints
USE [DWPubsSales]
GO
ALTER TABLE [dbo].[FactSales] WITH CHECK ADD CONSTRAINT [FK_FactSales_DimDates]
FOREIGN KEY([OrderDateKey])
REFERENCES [dbo].[DimDates] ([DateKey])
GO
ALTER TABLE [dbo].[DimTitles] WITH CHECK ADD CONSTRAINT [FK_DimTitles_DimDates]
Search WWH ::




Custom Search