none
SELECT MULTIPLE VALUES IN WHERE CLAUSE BASED ON THE VALUE PASSED AS INPUT PARAMETER

    Вопрос

  • I want to select multiple values from the database when I am passing a specific input parameter value to my stored procedure . How to do that ?

    Currently this is what I am doing..

    WHERE

    zDescription like '%WebQuote%'
      and
      (ExpectedCloseDate>=@startDateExClose and  ExpectedCloseDate-1<@endDate)
      and
      Status like
      CASE WHEN @status = 'SPA Pending' then Status IN('Active','SPA Pending')
      else
      @status end

    AND

    SO ON

    So when the input parameter is SPA Pending I want to select the status as both Active and SPA Pending and otherwise I want to select the Status as the exact value passed through the parameter for Status. Can anyone help me on this ?

    Thanks in advance.

    Regards,

    Vivek


    Vivek Kamath


    • Изменено Vik2907 10 июня 2012 г. 20:09
    10 июня 2012 г. 18:37

Ответы

Все ответы