I have question regarding adding/removing filters in SQL 2008 query. Here is example of one scenario where I have to use server side language (ColdFusion in my case) to add filter.
<cfif userdata.appaccess lt 8>
AND (building_list IN (<cfqueryparam value="#userdata.appBldgList#" cfsqltype="cf_sql_char" maxlength="4" list="yes">))
</cfif>
As you can see I have cfif
statement that checks if user access is less than 8 then include filter in the query. I'm wondering if there is a way to do this with SQL language? If it is, would that be better or more efficient option/solution? Coding standard in my project are not consistent and code is written by many different programmers that left and every new programmer started something new. I'm trying to find the best and the most efficient solution for these kind of situations. Any suggestions/example would be helpful. Thank you.