;-)Thanks a lot for your response.
I always feel a very friendly supportive environment here.
I will definetly compare performance of regular vs dynamic SQL procedures.
But later.
My goal now is to come up with a "pure TSQL" mechanism
that handles this dynamic WHERE clause.
I see it all over the place in the Java code I am converting.
So it's like a pattern that I need find out how to handle nicely.
I feel like if I give up and do it with dynamic SQL - I surrender
and don't improve my TSQL skills .. 🙂
Again, a pattern is (java code)
sqlStmt = "select * from IndustryMap";
sqlStmt += " WHERE 1=1 " + whereSQLStmt;
if(cusip != null && cusip.length()>0){
whereSQLStmt += " and id_cusip = '" + cusip + "' ";}
if(ticker != null && ticker.length()>0){
whereSQLStmt += " and ticker = '" + ticker + "' ";}
if(exchangeCode != null && exchangeCode.length()>0){
whereSQLStmt += " and exch_Code = '" + exchangeCode + "' ";
They dynamically build WHERE clause
if input parameter is not null.
There are hundreds of these cases in Java.