• Karl,

    Thanks for your reply. Well, actually, I think I should have mentioned that I am not describing a full blown data warehouse implementation. Building and maintaining a data warehouse is too expensive for the small and medium sized companies I work for. There are numerous companies like these and they also have their reporting needs and their problems to be solved.

    I think you are right when you say that it makes a lot of sense to have delivery times stored in a data warehouse. That is, if you have one... The same is true for your remarks about null values for ship_date and a separate fact table for shipment facts. But discussing those issues would lead us to talking about details of an order management data mart and, although potentially very interesting, that is not what I had in mind at this point.

    I have a question:

    Your code

    select count(*) from dbo.TstCalendar where Date between @delivery_day and @ship_date and ProdDay ='Y'

    gives the correct number of production days between two dates, but how would you implement this code, when you want to report on, let's say, 50,000 records? (given a poor man's data mart consisting of a denormalized invoice-orders table with order_date and ship_date on the same row)

    Gijs