Search code examples
reporting-servicesodbc

Same parameter for different columns in SSRS


I need to do a report in SSRS that gets a patient by case number or surgery ID name using the same textbox over ODBC.

So my query is SELECT Name, DOB FROM Surgeries Where caseno = ? or sgid = ?. Since in ODBC, these are 2 separate parameters and I need to search only for one or the other. Is it possible? How my query can be optimized?


Solution

  • Although I think that earlier comments should work fine, here is an alternative approach.

    Please note that this is untested.

    SELECT Name, DOB FROM Surgeries WHERE ? IN(caseno, sgid)
    

    This also assumes that the parameter is NOT multi-valued.