Passing parameters to query without TVFs


Problem Statement

You have a need to extract data from a table or view with 1 or more parameters.  The challenge is that the parameter changes based on various factors.

The solution often is to write this, not as a view, but as a Stored Procedure or a Table Valued Function (TVF) that accepts a parameter and inserts the value of the parameter wherever required in your code. This typically should be for a scalar value, such as a Foreign Key or Primary Key lookup value.

The problem is further that there are many times when you would NOT want