Flexible Custom Reports for SQL Server  This article is written by developer for other developers, sharing my experience with a technique that I found in Kimberly Tripp's SQL Server blog article titled " Building High Performance Stored Procedures ".  In her article, she demonstrated a dynamic SQL technique that allows for "Query By Example" screens that allow most fields to be optional.  I would strongly encourage you to read her article along with the associated cautionary notes.  I would further add that this technique should not be used for any automated reporting tasks.  If you have a known report requirement, make a dedicated stored procedure for it!   I am writing this article to share a few refinements as well as a nice way to catch refactoring dependencies when this stored procedure is part of a database project in Visual Studio.  As a point of reference, I used MS SQL 2014 and Visual Studio 2017, but the technique should work with older versions of SQ...
My experiences with computer programming, using c#, Mono, Ruby, Rails, SQL Server 2000, and MySQL.