2 Replies Latest reply: Aug 15, 2014 12:07 PM by Faiq Ishaque RSS

    Changinig Variable value

    Faiq Ishaque



      I have a variable in my load script that holds the value of last modified date.  This part works fine and hold value of Var_Max_Of_Sales_Modified_Date=2014-08-12 16:03:31


      LOAD *
      Resident Sales_Fact
      Order By Modified_Date;
      Let Var_Max_Of_Sales_Modified_Date=Peek('Modified_Date', -1, 'Sort_Sales');




      Then I try to use this variable value in the next SQL script and it fails


      Select * from sales_fact  where modified_Date=$(Var_Max_Of_Sales_Modified_Date);


      The SQL scripts expects where modified_Date='2014-08-12 16:03:31' basically these single ticks around the variable value.


      I would appreciate any help.







        • Re: Changinig Variable value
          m w

          Put the single quotes around the $ expanded variable:

          Select * from sales_fact  where modified_Date='$(Var_Max_Of_Sales_Modified_Date)';

            • Re: Changinig Variable value
              Faiq Ishaque

              Thanks . It goes through without an error so I guess it should work. It is still not getting the desired rows as now the SQL statement is expecting the ending numbers after seconds.


              so how can I format Modified_Date so it is

              2014-08-12 16:03:31.643

              and not

              2014-08-12 16:03:31


              Below is what I used before it is loaded into variable


              Date(Modified_Date, 'YYYY-MM-DD hh:mm:ss') as Modified_Date