2 Replies Latest reply: May 6, 2013 7:35 AM by sachin patil RSS

    How to write parameterized filter condition in query while fetching data

      Hi,

       

      I have a requirement where I need to pull data from a database and my filter condition should be parameterized and should come from a text/excel file. So that business user can open that text/excel file and can change the condition accordingly.

       

      For example:

       

      My query is:

       

      Select *

      from dbo.Customer

      where customerID in (22, 12)

      and StateID in (100, 102, 125)

       

      Now in above query how can I store these customerID values & StateID values in text/excel and this query calls those parameters from that file and then execute. In a way it will be dynamic so tomorrow user can go to this file and change the parameter value and without chaning any code the script will still work.

       

      Best Regards,

      Sachin