But that makes the query "SELECT DISTINCT PATN_ISD FROM $tabName WHERE PATN_ISD > '20051231' ORDER BY PATN_ISD" when it is sent to texis. I want it to be:
SELECT DISTINCT PATN_ISD FROM PATN_TEST WHERE PATN_ISD > '20051231' ORDER BY PATN_ISD
Make sure "tabName" is not coming from the user via form input or similar. If it is they can change it to something that will change the meaning of your SQL. If it's based on user input (even if it's "hidden" on the form) it should be sanitized before use in SQL.