I want to extract all the list of databaseName.tableName
from all my SQL queries after from or join and dedupe them, put them into a 2 column CSV file with FileName, Database.TableName list. I do have sometime schema in between database and table names, I may want to remove that part.
For example:
File#1 = Create table xyz as select * from abc.bcd;
File#2 = Create table sdf as select * from asd.fgh;
I wanted:
FileName Table
File#1 abc.bcd
File#2 asd.fgh
This is what I tried -
Select-String -Path "\shared\path*.sql" -Pattern 'from|join|update|into\s(\w{100})'
But not getting exact output needed, more info in the comment.