Hello everyone,
I am having trouble adding records into a Facts table, because it is linked to other dimension tables through keys. I have a Facts/Sales/Invoice table that has the following columns:
InvoiceNumber (Primary Key)
Order_Date (Foreign Key, connected to the Primary Key of the DimCalendar table)
CustomerID (Foreign Key, connected to the Primary Key of the DimCustomers table)
ProductID (Foreign Key, connected to the Primary Key of the DimProducts table)
Quantity
Price
TotalAmount
When I try to insert records into this table, I receive the following error:
Msg 547, Level 16, State 0, Line 1
The INSERT statement conflicted with the FOREIGN KEY constraint "Order_Date". The conflict occurred in database "Digiprotech", table "dbo.DimCalendar", column 'Order_Date'.
The statement has been terminated.
It appears that it will not let me insert into the table unless the values exist in each of their corresponding dimension tables. Is there anyway around this aside from dropping the key constraints on all the other tables? If I remove the key constraints, it will allow me to insert.
Thank you,
Deep