Forum Discussion
VBA_ENTHU1988
Nov 09, 2021Copper Contributor
Search a List of Table names in SQL
Hi,
I have multiple SQL's generally each one having 100+ lines of SQL code ,
Swcond I have a list of tables stored in Excel column wise
Task -- I want to search if any of these table names exist in any SQL code
Example -- I have Table A , Table B , Table C, etc stored in Excel
Second excel or Same Excel different sheet has SQL codes
Now I do not want to manually search each Table in each SQL code by doing CNTRL +F rather a code that scans the SQL code line by line for all the table names stored in different sheet
I have created a simple example in attached excel wherein I have first sheet with SQL code taken from internet as I cannot share actual code and Sheet 2 with Table list to be search in Sheet 1
Kindly help
Afraid that's not exactly Excel task. Before the formal logic is to be defined how to extract table name from SELECT, JOIN, etc. With it we may parse SQL statement with Excel or any other tool.
- VBA_ENTHU1988Copper Contributor
Actually i was trying to separate the table names from the query maybe by using macros and then once that is separated we can easily make a vlookup or something
That doesn't matter what to use. Macros, poor formulas, Power Query, whatever. Without the formal logic for parsing non of them works.