2 Replies Latest reply: Jul 24, 2013 11:16 PM by Paul Scotchford RSS

    Not all tables loaded by LOAD Script

    Paul Scotchford

      Hi

       

      I am trying to do a LOAD (using T-SQL) to load 2 tables, however only one table shows up in the Model.

      I have tried many different combinations to the script but still end up with the 1st table only.

       

       

      BaseMeasures:


      LOAD * ;     

      SQL select  BaseMeasures.MeasureName
                         ,BaseMeasures.MeasureCalculation
               from
                          dbo.BaseMeasures ;

       

      DerivedMeasures1:


      LOAD *;

      SQL select DerivedMeasures.MeasureName
                        ,DerivedMeasures.MeasureCalculation
                  from
                          dbo.DerivedMeasures;

       

      The second table does not show in the model diagram, it will LOAD if I rename the fields to something different, but does that not defeat what QV is about (i.e. Associative)? These tables are not expected to form associations for the user, they are for the developer to use as we keep Measures and their calcs in a business dictionary on SQLServer (2012)

       

      Thanks is advance for responses

      Paul

        • Re: Not all tables loaded by LOAD Script
          Rob Wunderlich

          The rows from both tables are being loaded. They are being concatenated into a single table due to QV's auutomatic concatenation feature. If the field list in a LOAD has exactly the same field list as an existing table, it will be concatenated to the existing table.

           

          If you want two tables, you can either use the NOCONCATENATE prefix on the second load, or use different names. Using the QUALIFY *; statement is an easy way to generate distinct names -- they will then use the tablename as a prefix.

           

           

          -Rob

            • Re: Not all tables loaded by LOAD Script
              Paul Scotchford

              Rob, Once again, many thanks for your solution to my question.

              I have included a code stub of my actual implementation for others to reference using your solution.

               

              QUALIFY *;
              DynamicVariables:
              LOAD              
               
              ObjectName,
                ObjectValue ;
              SQL select
                          StaticVariables.ObjectName
                         ,StaticVariables.ObjectValue
              from
                       dbo.StaticVariables;