I have built a QlikView script generator (QVS), that can be used to generate large script files for data imports from SQL Server to QlikView.

QlikView does not like 'fully' normalised database structures (loops between several tables): for example, three tables A, B, C in SQL Server could have three PK/FK links; in QlikView it requires just two. So, I now have to 'denormalize', or remove the loops between tables...

Currently I am creating an 'exclusion table', which I traverse with an quad-imbedded for-loop, to isolate and remove constraints in the DB structure before generating the script file. This seems to work, but takes WAY too long as the number of tables can be large.

Is there another way that I can achieve what I want more economically?

No real working database can ever be "fully" normalised. We are talking about a 2nd normal form standard. A fully normailised database is an phantom that I personally have never come accross...
–
KillercamJan 16 '13 at 18:53

@Killercam: Did you try creating some intermediate tables holding the denormalized data? This is typically task which can be done by some sophisticated "SELECT INTO" statements or an optimized stored procedure. And if this is too slow, you should provide us with some more details about your data model (though this question may be better suited for SO then).
–
Doc BrownJan 16 '13 at 19:21