views:

17

answers:

1

I am going to design a DW and I heard about materialized views. Actually I want to create a view and it should update automatically when base tables are changed. Can anyone explain with an query example..

+1  A: 

They're called indexed views in SQL Server - read these white papers for more background:

Basically, all you need to do is:

  • create a regular view
  • create a clustered index on that view

and you're done!

The tricky part is: the view has to satisfy quite a number of constraints and limitations - those are outlined in the white paper. If you do this - that's all there is. The view is being updated automatically, no maintenance needed.

Additional resources:

marc_s
Thanks for your reply. I got what i want.. I would like to know about indexes as well. I want to know is there any way to generate star schema diagram in SQL server when I have all the table structure ready ? If Yes how do i create fact table for that ?
Deepak