2 Replies Latest reply: Dec 7, 2010 6:21 AM by dvavasis RSS

    store procedure using CASE statement

      Hi Guys,

      I am using a stored procedure that uses a case statement...

      example:

      "SELECT s. [Customer No_],s. [Due Date],s. [Posting Date],'Ageing from Due/Date' =

       

       

      case

       

      WHEN

      DATEDIFF(day,s. [Due Date],@MyDate) <= 30 then '[0 - 30D Days]'..etc"



       

      while I get results using these statements

       

      Let

       

       

      LOAD [Customer No_],[Due Date],[Posting Date],[Name],[Document No_],[Amount] as Amount,

      'Ageing from Due/Date', 'Ageing from Post/date';



      SQL

       

       

      EXEC dbo.cust_ageing @MyDate = '$(MyDate)'; Mydate = Input('Enter date', 'ageing date');

      I do not see results "categoried" by 'Ageing from Due/Date' ..

      is there something special about the CASe statement??

       

      TIA





        • store procedure using CASE statement

          Few comments:

           

          • do you pass the parameter of the stored procedure from QlikView ?
          • if you use arithmetic operators as part of the column names, those need to be escaped in database dependent way. It is easier to use names consisting only of letters, numbers and underscore


          -Alex

            • store procedure using CASE statement
              • do you pass the parameter of the stored procedure from QlikView ?

              yes...

               

               

               

               

               





               

              Let

               

               

              MyDate = Input('Enter date', 'aging referernce date');

               

              SQL EXEC dbo.cust_ageing @MyDate = '$(MyDate)';

               



               

               

               

               

               



              if you use arithmetic operators as part of the column names, those need to be escaped in database dependent way. It is easier to use names consisting only of letters, numbers and underscore

              can you give me an example? what do you mean "in database dependent way"...?

              thanks