I've thousand of queries I need to execute from a text file.
See bellow a kind of query I have:
SELECT *
FROM T1 A
INNER JOIN DB2.dbo.CI_T1 B ON A.id= B.id
LEFT OUTER JOIN T3 C ON B.id = C.id
WHERE ...
Some of tables are well named (database.owner.table_name
), and some other no (table_name
).
How can I use a regex to update each query to replace unqualified instances of table_name
with database.owner.table_name
?
I write fiddle to test it: http://www.phpliveregex.com/p/9SH and http://www.phpliveregex.com/p/9SF