Home All Groups Group Topic Archive Search About

Looping through Dimension Tables and Joining To Fact Table

Author
21 Jul 2006 4:23 PM
MarkFrank
Hi all,

Does anyone have an example of some code that would loop through dimension
tables in a database join to a fact table and return counts?  I'm basically
building a cube with a ton of dimensions and want to avoid having to process
then eliminate to find out which dimension table has missng key values.

I.e. For each Table in Database
         If left(table,3) = 'Dim' Then
             Select count(*) from current table join Fact_table on
curr_table Key join fact_table key (might need a nested loop to match the
column key names).
         Next table.

With T-SQL/Cursors?

Thanks in advance.

AddThis Social Bookmark Button