Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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... – Killercam Jan 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 Brown Jan 16 '13 at 19:21

Standard algorithm for denormalization:

  1. Let's take that rows of A,B,C tables are linked in mn:n:1 proportion.

  2. Make three inserted cycles by each C by each appropriate B by each appropriate A.

  3. For each row in the inner cycle make a new row of the result table.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.