I am not a db admin by any means so if semantics look a bit bizarre, I apologize. In SQL Server, is it possible to use a variable for a comparison operator like so?
declare @compare = '>';
declare @limit = '5';
select agentId, sessionId, duration
from table_x
where duration @compare @limit
I do not want to write a ton of lines depending on what the variable could be, which is why I ask. Not to mention if I throw in another variable, that further makes the amount of lines even larger. Also, I like the fact that it's extensible, so in the event there was an additional operator, it would just process it anyway.
Thanks for the help!
@UpperLimitand@LowerLimit. (this is assuming you're only looking at > and <). Just throwing it out there.